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

feat(evm): aggressive optimization #2965

Merged
merged 28 commits into from
Oct 7, 2024
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
2a0500f
feat(evm): aggressive optimization
hussein-aitlahcen Sep 16, 2024
9ccef15
feat(evm): batch send|acks entrypoints
hussein-aitlahcen Sep 21, 2024
67940d4
feat(evm): normalized port in channel events
hussein-aitlahcen Sep 23, 2024
f61cdef
chore(evm): better comments
hussein-aitlahcen Sep 25, 2024
87339bf
feat(evm): remove delay period
hussein-aitlahcen Sep 30, 2024
e3c0e22
feat(evm): remove old tests
hussein-aitlahcen Sep 30, 2024
7248fd0
feat(evm): scaffold tests on new stack
hussein-aitlahcen Sep 30, 2024
5ae36f2
feat(evm): drop support for proto
hussein-aitlahcen Sep 30, 2024
73e137f
feat(evm): reword intent entrypoints
hussein-aitlahcen Sep 30, 2024
ad511ce
fix(evm): fixup proto varint, recvPacket with maker msg, upgrade prot…
hussein-aitlahcen Sep 30, 2024
1ae2f53
feat(evm): ibc connection tests
hussein-aitlahcen Sep 30, 2024
6c2fe53
feat(evm): ibc channel tests scaffolding
hussein-aitlahcen Sep 30, 2024
7e87654
feat(evm): ibc channel tests
hussein-aitlahcen Sep 30, 2024
abcd55c
feat(evm): upgrade foundry
hussein-aitlahcen Sep 30, 2024
b62a5f1
chore(evm): fmt
hussein-aitlahcen Sep 30, 2024
e165584
feat(evm): ibc packet tests scaffolding
hussein-aitlahcen Sep 30, 2024
527b5ad
feat(evm): more ibc packet tests
hussein-aitlahcen Oct 1, 2024
02d672a
fix(evm): extract used protobuf fns
hussein-aitlahcen Oct 1, 2024
1d2b553
feat(evm): more ibc packet tests
hussein-aitlahcen Oct 1, 2024
66ac66f
feat(evm): finalize ibc packet tests
hussein-aitlahcen Oct 2, 2024
9e35b77
feat(evm): remove ports from packet/channel
hussein-aitlahcen Oct 2, 2024
9b87495
feat(evm): batch ibc packet extension tests
hussein-aitlahcen Oct 4, 2024
2830c21
feat(evm): upgrade ucs02 to new interface
hussein-aitlahcen Oct 4, 2024
4e6bf76
fix(evm): removed no longer used `Glue`
hussein-aitlahcen Oct 7, 2024
f231f8c
feat(evm): upgrade deployment scripts
hussein-aitlahcen Oct 7, 2024
55c4801
fix(evm): better wording and add clientType to created event
hussein-aitlahcen Oct 7, 2024
3ad2139
chore: fmt
hussein-aitlahcen Oct 7, 2024
9977f4f
fix(evm): avoid batching timeout as one can commit packets individually
hussein-aitlahcen Oct 7, 2024
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
6 changes: 3 additions & 3 deletions app/scripts/abi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ nix build .#evm-contracts --print-build-logs

IBC_HANDLER=$(jq --slurp 'map(.abi) | add' \
result/out/IBCClient.sol/IBCClient.json \
result/out/IBCPacket.sol/IBCPacket.json \
result/out/IBCConnection.sol/IBCConnection.json \
result/out/IBCPacket.sol/IBCPacketImpl.json \
result/out/IBCConnection.sol/IBCConnectionImpl.json \
result/out/OwnableIBCHandler.sol/OwnableIBCHandler.json \
result/out/IBCChannelHandshake.sol/IBCChannelHandshake.json)
result/out/IBCChannel.sol/IBCChannelImpl.json)

echo "export const ibcHandlerAbi = <const>${IBC_HANDLER}" >| app/src/lib/abi/ibc-handler.ts

Expand Down
2 changes: 1 addition & 1 deletion evm/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ sequenceDiagram

```

To relax the contract size limit of ethereum, each ICS implementation is split into [IBCClient](contracts/core/02-client/IBCClient.sol), [IBCConnection](contracts/core/03-connection/IBCConnection.sol), [IBCChannel](contracts/core/04-channel/IBCChannelHandshake.sol), [IBCPacket](contracts/core/04-channel/IBCPacket.sol), and [IBCHandler](contracts/core/25-handler/IBCHandler.sol) contracts, as shown in the above figure.
To relax the contract size limit of ethereum, each ICS implementation is split into [IBCClient](contracts/core/02-client/IBCClient.sol), [IBCConnection](contracts/core/03-connection/IBCConnection.sol), [IBCChannel](contracts/core/04-channel/IBCChannel.sol), [IBCPacket](contracts/core/04-channel/IBCPacket.sol), and [IBCHandler](contracts/core/25-handler/IBCHandler.sol) contracts, as shown in the above figure.

In general, such a design causes storage splitting, so it is required to implement unnecessary authentication and accessors for inter-contract calls.

Expand Down
39 changes: 0 additions & 39 deletions evm/contracts/Glue.sol

This file was deleted.

10 changes: 4 additions & 6 deletions evm/contracts/Multicall.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.8.23;
pragma solidity ^0.8.27;

struct Call3 {
address target;
Expand All @@ -14,11 +14,9 @@ struct Result {
event MulticallResult(Result[]);

contract Multicall {
function multicall(Call3[] calldata calls)
public
payable
returns (Result[] memory returnData)
{
function multicall(
Call3[] calldata calls
) public payable returns (Result[] memory returnData) {
uint256 length = calls.length;
returnData = new Result[](length);
Call3 calldata calli;
Expand Down
97 changes: 53 additions & 44 deletions evm/contracts/apps/Base.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
pragma solidity ^0.8.23;
pragma solidity ^0.8.27;

import "../core/05-port/IIBCModule.sol";

library IBCAppLib {
error ErrNotIBC();
error ErrNotImplemented();
}

/**
Expand Down Expand Up @@ -35,56 +36,52 @@ abstract contract IBCAppBase is IIBCModule {
/**
* @dev See IIBCModule-onChanOpenInit
*
* NOTE: You should apply an `onlyIBC` modifier to the function if a derived contract overrides it.
* NOTE: You must apply an `onlyIBC` modifier to the function if a derived contract overrides it.
*/
function onChanOpenInit(
IbcCoreChannelV1GlobalEnums.Order,
string[] calldata connectionHops,
string calldata portId,
string calldata channelId,
IbcCoreChannelV1Counterparty.Data calldata counterpartyEndpoint,
string calldata version,
address relayer
IBCChannelOrder,
uint32,
uint32,
IBCChannelCounterparty calldata,
bytes32,
address
benluelo marked this conversation as resolved.
Show resolved Hide resolved
) external virtual override onlyIBC {}

/**
* @dev See IIBCModule-onChanOpenTry
*
* NOTE: You should apply an `onlyIBC` modifier to the function if a derived contract overrides it.
* NOTE: You must apply an `onlyIBC` modifier to the function if a derived contract overrides it.
*/
function onChanOpenTry(
IbcCoreChannelV1GlobalEnums.Order,
string[] calldata connectionHops,
string calldata portId,
string calldata channelId,
IbcCoreChannelV1Counterparty.Data calldata counterpartyEndpoint,
string calldata version,
string calldata counterpartyVersion,
address relayer
IBCChannelOrder,
uint32,
uint32,
IBCChannelCounterparty calldata,
bytes32,
bytes32,
address
) external virtual override onlyIBC {}

/**
* @dev See IIBCModule-onChanOpenAck
*
* NOTE: You should apply an `onlyIBC` modifier to the function if a derived contract overrides it.
* NOTE: You must apply an `onlyIBC` modifier to the function if a derived contract overrides it.
*/
function onChanOpenAck(
string calldata portId,
string calldata channelId,
string calldata counterpartyChannelId,
string calldata counterpartyVersion,
address relayer
uint32,
uint32,
bytes32,
address
) external virtual override onlyIBC {}

/**
* @dev See IIBCModule-onChanOpenConfirm
*
* NOTE: You should apply an `onlyIBC` modifier to the function if a derived contract overrides it.
* NOTE: You must apply an `onlyIBC` modifier to the function if a derived contract overrides it.
*/
function onChanOpenConfirm(
string calldata portId,
string calldata channelId,
address relayer
uint32,
address
) external virtual override onlyIBC {}

/**
Expand All @@ -93,9 +90,8 @@ abstract contract IBCAppBase is IIBCModule {
* NOTE: You should apply an `onlyIBC` modifier to the function if a derived contract overrides it.
*/
function onChanCloseInit(
string calldata portId,
string calldata channelId,
address relayer
uint32,
address
) external virtual override onlyIBC {}

/**
Expand All @@ -104,19 +100,19 @@ abstract contract IBCAppBase is IIBCModule {
* NOTE: You should apply an `onlyIBC` modifier to the function if a derived contract overrides it.
*/
function onChanCloseConfirm(
string calldata portId,
string calldata channelId,
address relayer
uint32,
address
) external virtual override onlyIBC {}

/**
* @dev See IIBCModule-onRecvPacket
*
* NOTE: You should apply an `onlyIBC` modifier to the function if a derived contract overrides it.
* NOTE: You must apply an `onlyIBC` modifier to the function if a derived contract overrides it.
*/
function onRecvPacket(
IbcCoreChannelV1Packet.Data calldata packet,
address relayer
IBCPacket calldata,
address,
bytes calldata
)
external
virtual
Expand All @@ -125,24 +121,37 @@ abstract contract IBCAppBase is IIBCModule {
returns (bytes memory acknowledgement)
{}

/**
* @dev See IIBCModule-onRecvIntentPacket
*
* NOTE: You must apply an `onlyIBC` modifier to the function if a derived contract overrides it.
*/
function onRecvIntentPacket(
IBCPacket calldata,
address,
bytes calldata
) external virtual override onlyIBC returns (bytes memory) {
revert IBCAppLib.ErrNotImplemented();
}

/**
* @dev See IIBCModule-onAcknowledgementPacket
*
* NOTE: You should apply an `onlyIBC` modifier to the function if a derived contract overrides it.
* NOTE: You must apply an `onlyIBC` modifier to the function if a derived contract overrides it.
*/
function onAcknowledgementPacket(
IbcCoreChannelV1Packet.Data calldata packet,
bytes calldata acknowledgement,
address relayer
IBCPacket calldata,
bytes calldata,
address
) external virtual override onlyIBC {}

/**
* @dev See IIBCModule-onTimeoutPacket
*
* NOTE: You should apply an `onlyIBC` modifier to the function if a derived contract overrides it.
* NOTE: You must apply an `onlyIBC` modifier to the function if a derived contract overrides it.
*/
function onTimeoutPacket(
IbcCoreChannelV1Packet.Data calldata packet,
address relayer
IBCPacket calldata,
address
) external virtual override onlyIBC {}
}
Loading