Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ lint-py:
lint-nix:
find . -name "*.nix" ! -path './integration_tests/contracts/*' ! -path "./contracts/*" | xargs nixfmt -c

.PHONY: lint lint-fix lint-py
lint-nix-fix:
find . -name "*.nix" ! -path './integration_tests/contracts/*' ! -path "./contracts/*" | xargs nixfmt

.PHONY: lint-install lint lint-fix lint-py lint-nix lint-nix-fix

###############################################################################
### Releasing ###
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ require (
github.com/hashicorp/go-metrics v0.5.4
github.com/linxGnu/grocksdb v1.9.10-0.20250331012329-9d5f074653d1
github.com/spf13/cast v1.10.0
github.com/spf13/cobra v1.9.1
github.com/spf13/cobra v1.10.1
github.com/spf13/pflag v1.0.10
github.com/spf13/viper v1.21.0
github.com/stretchr/testify v1.11.1
Expand Down
6 changes: 3 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1671,11 +1671,11 @@ github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8
github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=
github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0=
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU=
Expand Down
4 changes: 2 additions & 2 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,8 @@ schema = 3
version = "v1.10.0"
hash = "sha256-dQ6Qqf26IZsa6XsGKP7GDuCj+WmSsBmkBwGTDfue/rk="
[mod."github.com/spf13/cobra"]
version = "v1.9.1"
hash = "sha256-dzEqquABE3UqZmJuj99244QjvfojS8cFlsPr/MXQGj0="
version = "v1.10.1"
hash = "sha256-OP6wdqk4dvBD8U5aicTkySHZ2s0LWnBo2TST2SmgcpM="
[mod."github.com/spf13/pflag"]
version = "v1.0.10"
hash = "sha256-uDPnWjHpSrzXr17KEYEA1yAbizfcsfo5AyztY2tS6ZU="
Expand Down
14 changes: 14 additions & 0 deletions integration_tests/contracts/contracts/Counter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

contract Counter {
uint public count;

function increase() public {
count++;
}

function decrease() public {
count--;
}
}
8 changes: 4 additions & 4 deletions integration_tests/contracts/contracts/Gravity.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "./CosmosToken.sol";

Expand Down Expand Up @@ -787,7 +787,7 @@ contract Gravity is ReentrancyGuard, AccessControl, Pausable, Ownable {
address[] memory _validators,
uint256[] memory _powers,
address relayerAdmin
) {
) Ownable(relayerAdmin) {
// CHECKS

// Check that validators, powers, and signatures (v,r,s) set is well-formed
Expand Down Expand Up @@ -825,7 +825,7 @@ contract Gravity is ReentrancyGuard, AccessControl, Pausable, Ownable {

// ACL

_setupRole(RELAYER_ADMIN, relayerAdmin);
_grantRole(RELAYER_ADMIN, relayerAdmin);
_setRoleAdmin(RELAYER, RELAYER_ADMIN);
_setRoleAdmin(RELAYER_ADMIN, RELAYER_ADMIN);

Expand Down
66 changes: 66 additions & 0 deletions integration_tests/contracts/contracts/Simple7702Account.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import "@openzeppelin/contracts/interfaces/IERC1271.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "account-abstraction/contracts/core/Helpers.sol";
import "account-abstraction/contracts/core/BaseAccount.sol";

/**
* Simple7702Account.sol
* A minimal account to be used with EIP-7702 (for batching) and ERC-4337 (for gas sponsoring)
*/
contract Simple7702Account is BaseAccount, IERC165, IERC1271, ERC1155Holder, ERC721Holder {

// address of entryPoint v0.8
function entryPoint() public pure override returns (IEntryPoint) {
return IEntryPoint(0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108);
}

/**
* Make this account callable through ERC-4337 EntryPoint.
* The UserOperation should be signed by this account's private key.
*/
function _validateSignature(
PackedUserOperation calldata userOp,
bytes32 userOpHash
) internal virtual override returns (uint256 validationData) {

return _checkSignature(userOpHash, userOp.signature) ? SIG_VALIDATION_SUCCESS : SIG_VALIDATION_FAILED;
}

function isValidSignature(bytes32 hash, bytes memory signature) public view returns (bytes4 magicValue) {
return _checkSignature(hash, signature) ? this.isValidSignature.selector : bytes4(0xffffffff);
}

function _checkSignature(bytes32 hash, bytes memory signature) internal view returns (bool) {
return ECDSA.recover(hash, signature) == address(this);
}

function _requireForExecute() internal view virtual override {
require(
msg.sender == address(this) ||
msg.sender == address(entryPoint()),
"not from self or EntryPoint"
);
}

function supportsInterface(bytes4 id) public override(ERC1155Holder, IERC165) pure returns (bool) {
return
id == type(IERC165).interfaceId ||
id == type(IAccount).interfaceId ||
id == type(IERC1271).interfaceId ||
id == type(IERC1155Receiver).interfaceId ||
id == type(IERC721Receiver).interfaceId;
}

// accept incoming calls (with or without value), to mimic an EOA.
fallback() external payable {
}

receive() external payable {
}
}
17 changes: 17 additions & 0 deletions integration_tests/contracts/contracts/Simple7702Counter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

contract Simple7702Counter {
uint public count;

function increase() public {
count++;
}

function decrease() public {
count--;
}

receive() external payable { }
fallback() external payable { }
}
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.20;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract TestERC20A is ERC20 {
Expand Down
11 changes: 11 additions & 0 deletions integration_tests/contracts/contracts/Utils.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pragma solidity ^0.8.20;

contract Utils {
function getCodeHash(address _account) public view returns (bytes32) {
bytes32 codeHash;
assembly {
codeHash := extcodehash(_account)
}
return codeHash;
}
}
9 changes: 9 additions & 0 deletions integration_tests/contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ import "hardhat-typechain";
module.exports = {
solidity: {
compilers: [
{
version: "0.8.28",
settings: {
optimizer: {
enabled: true
},
evmVersion: "prague"
}
},
{
version: "0.8.21",
settings: {
Expand Down
Loading
Loading