Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nadim-az committed Dec 18, 2024
1 parent 5fc418a commit 5e9379f
Show file tree
Hide file tree
Showing 20 changed files with 41 additions and 618 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ jobs:
cd ../hyperlane-monorepo/solidity && yarn install --frozen-lockfile
cd ../../../../.. && make e2e-test
- name: List broadcast directory
run: |
ls -R broadcast/ || echo "Broadcast directory not found"
- name: Upload run-latest.json // this contains info about all the transactions that were submitted to chain in e2e test
if: always()
uses: actions/upload-artifact@v4
with:
name: e2e-test-artifacts
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ config/local/config.yml
config/local/keys.json
out
broadcast
cache
cache
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ unit-test:

.PHONY: setup-foundry
setup-foundry:
cd tests/e2e && forge install \
cd tests/e2e && rm -rf lib && forge install \
foundry-rs/forge-std \
OpenZeppelin/[email protected] \
OpenZeppelin/[email protected] \
Expand Down
2 changes: 0 additions & 2 deletions tests/e2e/chainconfig/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ func modifyGovV1AppState(chainConfig ibc.ChainConfig, govAppState []byte) ([]byt
govGenesisState.Params.MaxDepositPeriod = &MaxDepositPeriod
govGenesisState.Params.VotingPeriod = &VotingPeriod

// govGenBz := MustProtoMarshalJSON(govGenesisState)

govGenBz, err := cdc.MarshalJSON(govGenesisState)
if err != nil {
return nil, fmt.Errorf("failed to marshal gov genesis state: %w", err)
Expand Down
63 changes: 0 additions & 63 deletions tests/e2e/conf/config.yml

This file was deleted.

12 changes: 0 additions & 12 deletions tests/e2e/conf/keys.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ pragma solidity >=0.8.25 <0.9.0;
import { stdJson } from "forge-std/StdJson.sol";
import { Script } from "forge-std/Script.sol";
import { TestERC20 } from "./TestERC20.sol";
import { ICS20Lib } from "./ICS20Lib.sol";
import { FastTransferGateway } from "./FastTransferGateway.sol";
import { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
Expand Down Expand Up @@ -38,7 +37,7 @@ contract E2EContractsDeploy is Script {
initData
);

(address addr, bool ok) = ICS20Lib.hexStringToAddress(E2E_FAUCET);
(address addr, bool ok) = hexStringToAddress(E2E_FAUCET);
require(ok, "invalid address");

erc20.mint(addr, 1_000_000_000_000_000_000);
Expand All @@ -63,4 +62,29 @@ contract E2EContractsDeploy is Script {
function _addressToString(address addr) internal pure returns (string memory) {
return Strings.toHexString(uint160(addr), 20);
}

function hexStringToAddress(string memory addrHexString) internal pure returns (address, bool) {
bytes memory addrBytes = bytes(addrHexString);
if (addrBytes.length != 42) {
return (address(0), false);
} else if (addrBytes[0] != "0" || addrBytes[1] != "x") {
return (address(0), false);
}
uint256 addr = 0;
unchecked {
for (uint256 i = 2; i < 42; i++) {
uint256 c = uint256(uint8(addrBytes[i]));
if (c >= 48 && c <= 57) {
addr = addr * 16 + (c - 48);
} else if (c >= 97 && c <= 102) {
addr = addr * 16 + (c - 87);
} else if (c >= 65 && c <= 70) {
addr = addr * 16 + (c - 55);
} else {
return (address(0), false);
}
}
}
return (address(uint160(addr)), true);
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 8 additions & 7 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (s *SolverTestSuite) SetupSuite(ctx context.Context) {
s.Require().NotNil(eth, "Ethereum chain (ChainA) is nil")
s.Require().NotNil(simd, "Cosmos chain (ChainB) is nil")

s.Require().True(s.Run("Set up environment", func() {
s.Require().True(s.Run("Set up EVM environment", func() {
err := os.Chdir("../..")
s.Require().NoError(err)

Expand All @@ -72,7 +72,6 @@ func (s *SolverTestSuite) SetupSuite(ctx context.Context) {
s.Require().NoError(err)
s.Require().NotNil(s.deployer, "Deployer wallet is nil")

// get faucet private key from string
s.faucet, err = crypto.HexToECDSA(testvalues.FaucetPrivateKey)
s.Require().NoError(err)

Expand All @@ -91,19 +90,19 @@ func (s *SolverTestSuite) SetupSuite(ctx context.Context) {
}))
}))

s.Require().True(s.Run("Deploy contracts", func() {
s.Require().True(s.Run("Deploy required EVM contracts", func() {
var (
stdout []byte
stderr []byte
err error
)

s.T().Logf("Deploying contracts with sender: %s", s.deployer.FormattedAddress())
s.T().Logf("Deploying EVM contracts with sender: %s", s.deployer.FormattedAddress())

// First deploy base contracts
stdout, stderr, err = eth.ForgeScript(ctx, s.deployer.KeyName(), ethereum.ForgeScriptOpts{
ContractRootDir: "./tests/e2e",
SolidityContract: "scripts/E2EContractsDeploy.s.sol:E2EContractsDeploy",
SolidityContract: "contracts/solidity/E2EContractsDeploy.s.sol:E2EContractsDeploy",
RawOptions: []string{
"--json",
"--force",
Expand All @@ -115,10 +114,12 @@ func (s *SolverTestSuite) SetupSuite(ctx context.Context) {

s.Require().NoError(err, fmt.Sprintf("error deploying contracts: \nstderr: %s\nstdout: %s\nerr: %s", stderr, stdout, err))

s.T().Logf("Deploying EVM hyperlane contracts with sender: %s", s.deployer.FormattedAddress())

// deploy hyperlane contracts with a different set of remappings
hyperlaneDeployOutput, stderr, err := eth.ForgeScript(ctx, s.deployer.KeyName(), ethereum.ForgeScriptOpts{
ContractRootDir: "./tests/e2e",
SolidityContract: "scripts/HyperlaneTestDeploy.s.sol:HyperlaneTestDeploy",
SolidityContract: "contracts/solidity/HyperlaneTestDeploy.s.sol:HyperlaneTestDeploy",
RawOptions: []string{
"--json",
"--force",
Expand Down Expand Up @@ -157,7 +158,7 @@ func (s *SolverTestSuite) SetupSuite(ctx context.Context) {
s.Require().NoError(err)
}))

s.Require().True(s.Run("Fund address with ERC20", func() {
s.Require().True(s.Run("Fund user address with ERC20", func() {
tx, err := s.erc20Contract.Transfer(s.GetTransactOpts(s.faucet), crypto.PubkeyToAddress(s.key.PublicKey), big.NewInt(testvalues.InitialBalance))
s.Require().NoError(err)

Expand Down
Loading

0 comments on commit 5e9379f

Please sign in to comment.