Skip to content

Commit

Permalink
feat(evm): aggressive optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
hussein-aitlahcen committed Sep 16, 2024
1 parent 1981197 commit e96abb0
Show file tree
Hide file tree
Showing 41 changed files with 1,318 additions and 2,460 deletions.
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
46 changes: 20 additions & 26 deletions evm/contracts/apps/Base.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,11 @@ abstract contract IBCAppBase is IIBCModule {
* NOTE: You should 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,
IBCChannelOrder ordering,
uint32 connectionId,
uint32 channelId,
IBCChannelCounterparty calldata counterpartyEndpoint,
bytes32 version,
address relayer
) external virtual override onlyIBC {}

Expand All @@ -53,13 +52,12 @@ abstract contract IBCAppBase is IIBCModule {
* NOTE: You should 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,
IBCChannelOrder ordering,
uint32 connectionId,
uint32 channelId,
IBCChannelCounterparty calldata counterpartyEndpoint,
bytes32 version,
bytes32 counterpartyVersion,
address relayer
) external virtual override onlyIBC {}

Expand All @@ -69,10 +67,9 @@ abstract contract IBCAppBase is IIBCModule {
* NOTE: You should 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,
uint32 channelId,
uint32 counterpartyChannelId,
bytes32 counterpartyVersion,
address relayer
) external virtual override onlyIBC {}

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

Expand All @@ -93,8 +89,7 @@ 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,
uint32 channelId,
address relayer
) external virtual override onlyIBC {}

Expand All @@ -104,8 +99,7 @@ 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,
uint32 channelId,
address relayer
) external virtual override onlyIBC {}

Expand All @@ -115,7 +109,7 @@ abstract contract IBCAppBase is IIBCModule {
* NOTE: You should apply an `onlyIBC` modifier to the function if a derived contract overrides it.
*/
function onRecvPacket(
IbcCoreChannelV1Packet.Data calldata packet,
IBCPacket calldata packet,
address relayer
)
external
Expand All @@ -131,7 +125,7 @@ abstract contract IBCAppBase is IIBCModule {
* NOTE: You should apply an `onlyIBC` modifier to the function if a derived contract overrides it.
*/
function onAcknowledgementPacket(
IbcCoreChannelV1Packet.Data calldata packet,
IBCPacket calldata packet,
bytes calldata acknowledgement,
address relayer
) external virtual override onlyIBC {}
Expand All @@ -142,7 +136,7 @@ abstract contract IBCAppBase is IIBCModule {
* NOTE: You should apply an `onlyIBC` modifier to the function if a derived contract overrides it.
*/
function onTimeoutPacket(
IbcCoreChannelV1Packet.Data calldata packet,
IBCPacket calldata packet,
address relayer
) external virtual override onlyIBC {}
}
Loading

0 comments on commit e96abb0

Please sign in to comment.