Skip to content

Commit

Permalink
Update relayer v0.4.19 (#23)
Browse files Browse the repository at this point in the history
* update relayer version

Signed-off-by: Naohiro Yoshida <[email protected]>
  • Loading branch information
yoshidan authored Dec 4, 2023
1 parent 128c68f commit 984e24a
Show file tree
Hide file tree
Showing 24 changed files with 272 additions and 231 deletions.
3 changes: 1 addition & 2 deletions e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ chain:
make -C chains build
make -C chains network
# Wait for one epoch to use BEP-126 validator
sleep 100
sleep 60

.PHONY:contracts
contracts:
Expand All @@ -17,7 +17,6 @@ relayer:
./testrly config init --home .testrly
./testrly chains add-dir config/demo/ --home .testrly
./testrly paths add ibc0 ibc1 ibc01 --file=config/path.json --home .testrly
sleep 100
./testrly tx clients ibc01 --home .testrly
./testrly tx update-clients ibc01 --home .testrly
./testrly tx connection ibc01 --home .testrly
Expand Down
4 changes: 2 additions & 2 deletions e2e/chains/bsc/config/config-bsc-rpc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ IPCPath = "geth.ipc"
HTTPHost = "0.0.0.0"
HTTPPort = 8545
HTTPVirtualHosts = ["*"]
HTTPModules = ["eth", "net", "web3", "txpool", "parlia"]
HTTPModules = ["eth", "net", "web3", "txpool", "parlia", "debug"]
WSPort = 8547
WSModules = ["net", "web3", "eth"]
WSModules = ["net", "web3", "eth", "debug"]

[Node.P2P]
MaxPeers = 30
Expand Down
9 changes: 6 additions & 3 deletions e2e/config/demo/ibc-0.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
"chain_id": "ibc0",
"eth_chain_id": 9999,
"rpc_addr": "http://localhost:8645",
"hdw_mnemonic": "math razor capable expose worth grape metal sunset metal sudden usage scheme",
"hdw_path": "m/44'/60'/0'/0/0",
"signer": {
"@type": "/relayer.chains.ethereum.signers.hd.SignerConfig",
"mnemonic": "math razor capable expose worth grape metal sunset metal sudden usage scheme",
"path": "m/44'/60'/0'/0/0"
},
"ibc_address": "0x702E40245797c5a2108A566b3CE2Bf14Bc6aF841",
"initial_send_checkpoint": 0,
"initial_recv_checkpoint": 0,
"enable_debug_trace": true,
"enable_debug_trace": false,
"average_block_time_msec": 3000,
"max_retry_for_inclusion": 5
},
Expand Down
9 changes: 6 additions & 3 deletions e2e/config/demo/ibc-1.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
"chain_id": "ibc1",
"eth_chain_id": 9999,
"rpc_addr": "http://localhost:8545",
"hdw_mnemonic": "math razor capable expose worth grape metal sunset metal sudden usage scheme",
"hdw_path": "m/44'/60'/0'/0/0",
"signer": {
"@type": "/relayer.chains.ethereum.signers.hd.SignerConfig",
"mnemonic": "math razor capable expose worth grape metal sunset metal sudden usage scheme",
"path": "m/44'/60'/0'/0/0"
},
"ibc_address": "0x702E40245797c5a2108A566b3CE2Bf14Bc6aF841",
"initial_send_checkpoint": 0,
"initial_recv_checkpoint": 0,
"enable_debug_trace": true,
"enable_debug_trace": false,
"average_block_time_msec": 3000,
"max_retry_for_inclusion": 5
},
Expand Down
4 changes: 2 additions & 2 deletions e2e/config/path.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"channel-id": "channel-0",
"port-id": "transfer",
"order": "unordered",
"version": "transfer-1"
"version": "ics20-1"
},
"dst": {
"chain-id": "ibc1",
Expand All @@ -15,7 +15,7 @@
"channel-id": "channel-0",
"port-id": "transfer",
"order": "unordered",
"version": "transfer-1"
"version": "ics20-1"
},
"strategy": {
"type": "naive"
Expand Down
2 changes: 1 addition & 1 deletion e2e/contracts/apps/recv.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = async (callback) => {
try {

const bank = await ICS20Bank.deployed()
const bobAmount = await bank.balanceOf(bob, `transfer/channel-0/simple`)
const bobAmount = await bank.balanceOf(bob, `transfer/channel-0/simple_erc_20_token_for_test`)
console.log("received = ", bobAmount.toString())
if (parseInt(bobAmount.toString(), 10) !== 20) {
return callback("bob amount error");
Expand Down
8 changes: 4 additions & 4 deletions e2e/contracts/apps/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@ module.exports = async (callback) => {
try {
// Mint
const bank = await ICS20Bank.deployed()
const mintResult = await bank.mint(alice, "simple", mintAmount, {
const mintResult = await bank.mint(alice, "simple_erc_20_token_for_test", mintAmount, {
from: alice
});
console.log("mint success", mintResult.tx);

// Send to counterparty chain
const transfer = await ICS20TransferBank.deployed()
const transferResult = await transfer.sendTransfer("simple", sendingAmount, bob, port, channel, timeoutHeight, {
const transferResult = await transfer.sendTransfer("simple_erc_20_token_for_test", sendingAmount, bob, port, channel, timeoutHeight, {
from: alice,
});
console.log("send success", transferResult.tx);

// Check reduced amount
const aliceAmount = await bank.balanceOf(alice, "simple")
const aliceAmount = await bank.balanceOf(alice, "simple_erc_20_token_for_test")
console.log("after = ", aliceAmount.toString())
if (parseInt(aliceAmount.toString(), 10) !== mintAmount - sendingAmount) {
return callback("alice amount error");
}

// Check escrow balance
const escrowAmount = await bank.balanceOf(transfer.address, "simple")
const escrowAmount = await bank.balanceOf(transfer.address, "simple_erc_20_token_for_test")
console.log("escrow = ", escrowAmount.toString())
if (parseInt(escrowAmount.toString(), 10) !== sendingAmount) {
return callback("escrow amount error");
Expand Down
6 changes: 6 additions & 0 deletions e2e/contracts/contracts/clients/ParliaClient.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,16 @@ contract ParliaClient is ILightClient {
address internal ibcHandler;
mapping(string => ClientState.Data) internal clientStates;
mapping(string => mapping(uint128 => ConsensusState.Data)) internal consensusStates;
mapping(string => ClientStatus) internal statuses;

constructor(address ibcHandler_) {
ibcHandler = ibcHandler_;
}

function getStatus(string calldata clientId) external view virtual override returns (ClientStatus) {
return statuses[clientId];
}

/**
* @dev createClient creates a new client with the given state
*/
Expand Down Expand Up @@ -76,6 +81,7 @@ contract ParliaClient is ILightClient {

clientStates[clientId] = clientState;
consensusStates[clientId][height.toUint128()] = consensusState;
statuses[clientId] = ClientStatus.Active;
return (
keccak256(clientStateBytes),
ConsensusStateUpdate({consensusStateCommitment: keccak256(consensusStateBytes), height: height}),
Expand Down
2 changes: 1 addition & 1 deletion e2e/contracts/migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = async function (deployer) {
await deployer.deploy(IBCHandler, IBCClient.address, IBCConnection.address, IBCChannelHandshake.address, IBCPacket.address);

await deployer.deploy(ParliaClient, IBCHandler.address);
await deployer.deploy(ERC20Token, "simple", "simple", 1000000);
await deployer.deploy(ERC20Token, "simple_erc_20_token_for_test", "simple_erc_20_token_for_test", 1000000);
await deployer.deploy(ICS20Bank);
await deployer.deploy(ICS20TransferBank, IBCHandler.address, ICS20Bank.address);
};
Loading

0 comments on commit 984e24a

Please sign in to comment.