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: push0 opcode is not tested #1273

Merged
merged 14 commits into from
Dec 22, 2023
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## UNRELEASED

- [#1258](https://github.com/crypto-org-chain/cronos/pull/1258) Support hard-fork style upgrades.
- [#1273](https://github.com/crypto-org-chain/cronos/pull/1273) Enable push0 opcode in integration test

*December 11, 2023*

Expand Down
1 change: 1 addition & 0 deletions integration_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@


def pytest_configure(config):
config.addinivalue_line("markers", "unmarked: fallback mark for unmarked tests")
config.addinivalue_line("markers", "slow: marks tests as slow")
config.addinivalue_line("markers", "gravity: gravity bridge test cases")
config.addinivalue_line("markers", "ica: marks ica tests")
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/contracts/contracts/CosmosToken.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.8.10;
pragma solidity ^0.8.21;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./ICosmosToken.sol";

Expand Down
2 changes: 1 addition & 1 deletion integration_tests/contracts/contracts/Gravity.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.8.10;
pragma solidity 0.8.21;

import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/contracts/contracts/ICosmosToken.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;
pragma solidity 0.8.21;

/**
* @dev Interface of the CosmosToken deployed by the gravity contract
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.8.10;
pragma solidity 0.8.21;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract TestBlackListERC20 is ERC20 {
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/contracts/contracts/TestCRC20.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.8.10;
pragma solidity 0.8.21;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

// An utility erc20 contract that has a fancy method
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/contracts/contracts/TestERC20A.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.8.10;
pragma solidity 0.8.21;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract TestERC20A is ERC20 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.8.10;
pragma solidity 0.8.21;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

// An utility erc20 contract that has a fancy method
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.8.10;
pragma solidity 0.8.21;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract TestERC21Source is ERC20 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.8.10;
pragma solidity 0.8.21;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

// This contract is for testing a case on the gravity bridge when attacker try to send an amount
Expand Down
5 changes: 3 additions & 2 deletions integration_tests/contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ module.exports = {
solidity: {
compilers: [
{
version: "0.8.10",
version: "0.8.21",
settings: {
optimizer: {
enabled: true
}
},
evmVersion: "shanghai"
}
},
{
Expand Down
2 changes: 2 additions & 0 deletions integration_tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def test_send_transaction(cluster):
)
receipt = w3.eth.wait_for_transaction_receipt(txhash)
assert receipt.status == 1
assert receipt.gasUsed == 21000


def test_events(cluster, suspend_capture):
Expand All @@ -59,6 +60,7 @@ def test_events(cluster, suspend_capture):
w3,
CONTRACTS["TestERC20A"],
key=KEYS["validator"],
exp_gas_used=633810,
mmsqe marked this conversation as resolved.
Show resolved Hide resolved
yihuang marked this conversation as resolved.
Show resolved Hide resolved
)
tx = erc20.functions.transfer(ADDRS["community"], 10).build_transaction(
{"from": ADDRS["validator"]}
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/test_ibc_rly_gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_ibc(ibc):
cli = ibc.cronos.cosmos_cli()
wait_for_new_blocks(cli, 1)
rly_transfer(ibc)
diff = 0.005
diff = 0.01
mmsqe marked this conversation as resolved.
Show resolved Hide resolved
record = log_gas_records(cli)
if record:
records.append(record)
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/test_pruned_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_pruned_node(cronos):
)
signed = sign_transaction(w3, tx, KEYS["validator"])
txhash = w3.eth.send_raw_transaction(signed.rawTransaction)
exp_gas_used = 51384
exp_gas_used = 51383

print("wait for prunning happens")
wait_for_new_blocks(cronos.cosmos_cli(0), 10)
Expand Down
5 changes: 4 additions & 1 deletion integration_tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@
).decode()


def deploy_contract(w3, jsonfile, args=(), key=KEYS["validator"]):
def deploy_contract(w3, jsonfile, args=(), key=KEYS["validator"], exp_gas_used=None):
"""
deploy contract and return the deployed contract instance
"""
Expand All @@ -360,6 +360,9 @@
tx = contract.constructor(*args).build_transaction({"from": acct.address})
txreceipt = send_transaction(w3, tx, key)
assert txreceipt.status == 1
if exp_gas_used is not None:
assert exp_gas_used == txreceipt.gasUsed, \

Check failure on line 364 in integration_tests/utils.py

View workflow job for this annotation

GitHub Actions / Lint python

./integration_tests/utils.py:364:16: BLK100 Black would make changes.
f'exp {exp_gas_used}, got {txreceipt.gasUsed}'
address = txreceipt.contractAddress
return w3.eth.contract(address=address, abi=info["abi"])

mmsqe marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading