Skip to content

Commit

Permalink
Cancun support (#2795)
Browse files Browse the repository at this point in the history
* test transient storage (eip-1153)
* update evm and frontier deps
* fix test-block-storage-growth
* feat: support for cancun selfdestruct changes (EIP-6780)
* add test to verify the nonce increment bug (MOON-2806)

---------

Co-authored-by: Agusrodri <agusrodriguez2456@gmail.com>
Co-authored-by: Ahmad Kaouk <ahmadkaouk.93@gmail.com>
Co-authored-by: Éloïs <c@elo.tf>
  • Loading branch information
4 people authored May 24, 2024
1 parent e60aa01 commit f63af52
Show file tree
Hide file tree
Showing 17 changed files with 6,773 additions and 7,779 deletions.
62 changes: 31 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions runtime/moonbase/tests/xcm_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2586,17 +2586,11 @@ fn empty_account_should_not_be_reset() {
parachain::EVM::remove_account(&evm_account());
// Verify reference count.
let account = parachain::System::account(evm_account_id);
// TODO: after introducing the suicided fix the value for account.sufficients will remain 1
// until the storage is not completely removed, it will have to be decreased to 0 once the
// storage can be fully removed
assert_eq!(account.sufficients, 1);
assert_eq!(account.sufficients, 0);
assert_eq!(account.consumers, 0);
assert_eq!(account.providers, 1);
// We expect the account to be alive in a Zero ED context.
// TODO: after introducing the suicided fix the nonce is increased by 1
// until the storage is not completely removed, it will have to be decreased to 1 once the
// storage can be fully removed
assert_eq!(parachain::System::account_nonce(evm_account_id), 2);
assert_eq!(parachain::System::account_nonce(evm_account_id), 1);
});
}

Expand Down
12 changes: 2 additions & 10 deletions runtime/moonbeam/tests/xcm_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2310,19 +2310,11 @@ fn empty_account_should_not_be_reset() {
parachain::EVM::remove_account(&evm_account());
// Verify reference count.
let account = parachain::System::account(evm_account_id);
// TODO: since the suicided logic was introduced an smart contract account
// is not deleted completely until it's data is deleted. Data deletion
// will be implemented in a future release
// account.sufficients shall be 0
assert_eq!(account.sufficients, 1);
assert_eq!(account.sufficients, 0);
assert_eq!(account.consumers, 0);
assert_eq!(account.providers, 1);
// We expect the account to be alive in a Zero ED context.
// TODO: since the suicided logic was introduced an smart contract account
// is not deleted completely until it's data is deleted. Data deletion
// will be implemented in a future release
// this shall be changed to 1
assert_eq!(parachain::System::account_nonce(evm_account_id), 2);
assert_eq!(parachain::System::account_nonce(evm_account_id), 1);
});
}

Expand Down
12 changes: 2 additions & 10 deletions runtime/moonriver/tests/xcm_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2620,19 +2620,11 @@ fn empty_account_should_not_be_reset() {
parachain::EVM::remove_account(&evm_account());
// Verify reference count.
let account = parachain::System::account(evm_account_id);
// TODO: since the suicided logic was introduced an smart contract account
// is not deleted completely until it's data is deleted. Data deletion
// will be implemented in a future release
// revert account.sufficients to 0
assert_eq!(account.sufficients, 1);
assert_eq!(account.sufficients, 0);
assert_eq!(account.consumers, 0);
assert_eq!(account.providers, 1);
// We expect the account to be alive in a Zero ED context.
// TODO: since the suicided logic was introduced an smart contract account
// is not deleted completely until it's data is deleted. Data deletion
// will be implemented in a future release
// the following needs to be 1
assert_eq!(parachain::System::account_nonce(evm_account_id), 2);
assert_eq!(parachain::System::account_nonce(evm_account_id), 1);
});
}

Expand Down
2 changes: 1 addition & 1 deletion test/contracts/src/ERC20ExcessGas.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ contract ERC20ExcessGas is ERC20WithInitialSupply {
uint256 amount
) public override returns (bool) {
// Consume gas to over Erc20XcmBridgeTransferGasLimit
for (uint i = 0; i < 2000; i++) {
for (uint i = 0; i < 2200; i++) {
_gasHog += i;
}

Expand Down
23 changes: 23 additions & 0 deletions test/contracts/src/dancun/ProxySuicide.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.24;

contract ProxyDeployer {
event ContractDestroyed(address destroyedAddress);

// Function to deploy a new Suicide contract
function deployAndDestroy(address target) public {
Suicide newContract = new Suicide();
newContract.destroy(target);
emit ContractDestroyed(address(newContract));
}

}

contract Suicide {
constructor() payable {
}

function destroy(address target) public {
selfdestruct(payable(target));
}
}
Loading

0 comments on commit f63af52

Please sign in to comment.