Skip to content

Commit

Permalink
feat: Edit tendermint proto files to comply with non wasm clients
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonAndell committed Jan 5, 2024
1 parent 9a90959 commit 1d8f528
Show file tree
Hide file tree
Showing 392 changed files with 63,813 additions and 13,444 deletions.
2 changes: 2 additions & 0 deletions contracts/javascore/ibc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dependencies {
implementation("foundation.icon:javaee-scorex:$scorexVersion")
implementation project(':lib')
implementation project(':score-util')
implementation project(':proto-lib')

testImplementation 'com.google.protobuf:protobuf-javalite:3.16.3'
testImplementation 'foundation.icon:javaee-rt:0.9.3'
Expand Down Expand Up @@ -45,6 +46,7 @@ jacocoTestReport {
tasks.named('compileJava') {
dependsOn(':score-util:jar')
dependsOn(':lib:jar')
dependsOn(':proto-lib:jar')
}

optimizedJar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@
import java.util.Map;
import java.util.function.Consumer;

import ibc.icon.structs.messages.*;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;

import foundation.icon.jsonrpc.model.TransactionResult;
import foundation.icon.score.client.DefaultScoreClient;
import foundation.icon.score.client.Wallet;
import ibc.icon.integration.ScoreIntegrationTest;
import ibc.icon.interfaces.IIBCChannelHandshakeScoreClient;
import ibc.icon.interfaces.IIBCClientScoreClient;
import ibc.icon.interfaces.IIBCConnectionScoreClient;
import ibc.icon.interfaces.IIBCHandlerScoreClient;
import ibc.icon.interfaces.IIBCHostScoreClient;
import ibc.icon.interfaces.IIBCPacketScoreClient;
import icon.proto.core.channel.Channel;
import icon.proto.core.channel.Packet;
import icon.proto.core.client.Height;
import icon.proto.core.connection.MerklePrefix;
import ibc.core.commitment.v1.MerklePrefix;
import icon.proto.core.connection.Version;
import foundation.icon.jsonrpc.model.TransactionResult;
import foundation.icon.score.client.DefaultScoreClient;
import foundation.icon.score.client.Wallet;
import ibc.icon.integration.ScoreIntegrationTest;
import icon.ibc.interfaces.IIBCChannelHandshakeScoreClient;
import icon.ibc.interfaces.IIBCClientScoreClient;
import icon.ibc.interfaces.IIBCConnectionScoreClient;
import icon.ibc.interfaces.IIBCHandlerScoreClient;
import icon.ibc.interfaces.IIBCHostScoreClient;
import icon.ibc.interfaces.IIBCPacketScoreClient;
import icon.ibc.structs.messages.*;
import score.Address;

public class IBCIntegrationTest implements ScoreIntegrationTest {
Expand Down Expand Up @@ -101,7 +101,7 @@ void establishConnection_fromICON() {
MsgConnectionOpenInit msgInit = new MsgConnectionOpenInit();
MerklePrefix prefix = new MerklePrefix();
prefix.setKeyPrefix("ibc".getBytes());
icon.proto.core.connection.Counterparty counterparty = new icon.proto.core.connection.Counterparty();
core.connection.Counterparty counterparty = new core.connection.Counterparty();
counterparty.setClientId(counterPartyClientId);
counterparty.setConnectionId(counterPartyConnectionId);
counterparty.setPrefix(prefix);
Expand Down Expand Up @@ -142,7 +142,7 @@ void establishConnection_fromCounterParty() {
version.setFeatures(List.of("f1"));
version.setIdentifier("id");

icon.proto.core.connection.Counterparty counterparty = new icon.proto.core.connection.Counterparty();
core.connection.Counterparty counterparty = new core.connection.Counterparty();
counterparty.setClientId(counterPartyClientId);
counterparty.setConnectionId(counterPartyConnectionId);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package ibc.ics02.client;

import ibc.icon.interfaces.ILightClient;
import ibc.icon.score.util.Logger;
import ibc.icon.score.util.NullChecker;
import ibc.icon.structs.messages.MsgCreateClient;
import ibc.icon.structs.messages.MsgUpdateClient;
import ibc.ics24.host.IBCHost;
import icon.ibc.interfaces.ILightClient;
import icon.ibc.structs.messages.MsgCreateClient;
import icon.ibc.structs.messages.MsgUpdateClient;
import score.Address;
import score.Context;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
import java.util.Arrays;
import java.util.List;

import ibc.icon.interfaces.ILightClient;
import ibc.icon.score.util.ByteUtil;
import ibc.icon.score.util.Logger;
import ibc.icon.structs.messages.MsgConnectionOpenAck;
import ibc.icon.structs.messages.MsgConnectionOpenConfirm;
import ibc.icon.structs.messages.MsgConnectionOpenInit;
import ibc.icon.structs.messages.MsgConnectionOpenTry;
import ibc.ics02.client.IBCClient;
import ibc.ics24.host.IBCCommitment;
import icon.proto.core.client.Height;
import icon.proto.core.connection.ConnectionEnd;
import icon.proto.core.connection.Counterparty;
import icon.proto.core.connection.Version;
import ibc.icon.score.util.ByteUtil;
import ibc.icon.score.util.Logger;
import ibc.ics02.client.IBCClient;
import ibc.ics24.host.IBCCommitment;
import icon.ibc.interfaces.ILightClient;
import icon.ibc.structs.messages.MsgConnectionOpenAck;
import icon.ibc.structs.messages.MsgConnectionOpenConfirm;
import icon.ibc.structs.messages.MsgConnectionOpenInit;
import icon.ibc.structs.messages.MsgConnectionOpenTry;
import score.Context;
import scorex.util.ArrayList;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
import java.math.BigInteger;
import java.util.List;

import ibc.icon.interfaces.ILightClient;
import ibc.icon.score.util.ByteUtil;
import ibc.icon.structs.messages.MsgChannelCloseConfirm;
import ibc.icon.structs.messages.MsgChannelCloseInit;
import ibc.icon.structs.messages.MsgChannelOpenAck;
import ibc.icon.structs.messages.MsgChannelOpenConfirm;
import ibc.icon.structs.messages.MsgChannelOpenInit;
import ibc.icon.structs.messages.MsgChannelOpenTry;
import icon.proto.core.channel.Channel;
import icon.proto.core.connection.ConnectionEnd;
import ibc.icon.score.util.ByteUtil;
import icon.ibc.interfaces.ILightClient;
import icon.ibc.structs.messages.MsgChannelCloseConfirm;
import icon.ibc.structs.messages.MsgChannelCloseInit;
import icon.ibc.structs.messages.MsgChannelOpenAck;
import icon.ibc.structs.messages.MsgChannelOpenConfirm;
import icon.ibc.structs.messages.MsgChannelOpenInit;
import icon.ibc.structs.messages.MsgChannelOpenTry;
import ibc.ics03.connection.IBCConnection;
import ibc.ics24.host.IBCCommitment;
import score.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
package ibc.ics04.channel;

import ibc.icon.interfaces.ILightClient;
import ibc.icon.score.util.ByteUtil;
import ibc.icon.score.util.Proto;
import ibc.icon.structs.messages.MsgRequestTimeoutPacket;
import ibc.ics24.host.IBCCommitment;
import icon.proto.core.channel.Channel;
import icon.proto.core.channel.Packet;
import icon.proto.core.client.Height;
import icon.proto.core.connection.ConnectionEnd;
import icon.ibc.interfaces.ILightClient;
import icon.ibc.structs.messages.MsgRequestTimeoutPacket;
import score.Context;
import score.DictDB;

import java.math.BigInteger;
import java.util.Arrays;

import icon.proto.core.channel.Channel;
import icon.proto.core.channel.Packet;
import icon.proto.core.client.Height;
import icon.proto.core.connection.ConnectionEnd;

public class IBCPacket extends IBCChannelHandshake {

public void _sendPacket(Packet packet) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ibc.ics05.port;

import ibc.icon.interfaces.IIBCModuleScoreInterface;
import ibc.icon.score.util.StringUtil;
import icon.ibc.interfaces.IIBCModuleScoreInterface;
import score.Address;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ibc.ics23.commitment;

import icon.proto.core.commitment.*;
import cosmos.ics23.v1.*;
import score.Context;
import scorex.util.ArrayList;
import scorex.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ibc.ics23.commitment;

import icon.proto.core.commitment.*;
import cosmos.ics23.v1.*;
import score.UserRevertedException;
import scorex.util.ArrayList;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import ibc.icon.score.util.ByteUtil;
import ibc.icon.score.util.Proto;
import icon.proto.core.commitment.*;
import cosmos.ics23.v1.*;
import score.Context;
import score.UserRevertedException;

Expand Down Expand Up @@ -42,7 +42,7 @@ public static byte[] doHashOrNoop(int hashOp, byte[] preImage) {
public static byte[] doHash(int hashOp, byte[] preImage) {
if (hashOp == HashOp.SHA256) {
return Context.hash("sha-256", preImage);
} else if (hashOp == HashOp.KECCAK) {
} else if (hashOp == HashOp.KECCAK256) {
return Context.hash("keccak-256", preImage);
} else if (hashOp == HashOp.RIPEMD160) {
throw new UserRevertedException("RIPEMD160 hash not supported");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ibc.ics23.commitment;

import icon.proto.core.commitment.*;
import cosmos.ics23.v1.*;
import score.UserRevertedException;

import java.math.BigInteger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import ibc.icon.score.util.StringUtil;
import ibc.ics23.commitment.Ics23;
import ibc.ics23.commitment.Proof;
import icon.proto.clients.tendermint.MerkleRoot;
import icon.proto.core.commitment.*;
import cosmos.ics23.v1.*;
import ibc.core.commitment.v1.*;
import score.UserRevertedException;
import scorex.util.ArrayList;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package ibc.ics24.host;

import ibc.icon.interfaces.IIBCHost;
import ibc.icon.interfaces.ILightClient;
import ibc.icon.interfaces.ILightClientScoreInterface;
import ibc.icon.score.util.NullChecker;
import ibc.ics05.port.ModuleManager;
import icon.ibc.interfaces.IIBCHost;
import icon.ibc.interfaces.ILightClient;
import icon.ibc.interfaces.ILightClientScoreInterface;
import score.*;
import score.annotation.External;
import scorex.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import java.math.BigInteger;

import ibc.icon.structs.messages.MsgCreateClient;
import icon.ibc.structs.messages.MsgCreateClient;

public class IBCHandler extends IBCHandlerPacket {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import java.util.List;

import ibc.icon.interfaces.IIBCChannelHandshake;
import ibc.icon.interfaces.IIBCModuleScoreInterface;
import ibc.icon.structs.messages.*;
import icon.proto.core.channel.Channel;
import icon.ibc.interfaces.IIBCChannelHandshake;
import icon.ibc.interfaces.IIBCModuleScoreInterface;
import icon.ibc.structs.messages.*;
import score.annotation.EventLog;
import score.annotation.External;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package ibc.ics25.handler;

import ibc.icon.interfaces.IIBCClient;
import ibc.icon.structs.messages.MsgCreateClient;
import ibc.icon.structs.messages.MsgUpdateClient;
import ibc.ics04.channel.IBCPacket;
import icon.ibc.interfaces.IIBCClient;
import icon.ibc.structs.messages.MsgCreateClient;
import icon.ibc.structs.messages.MsgUpdateClient;
import score.annotation.EventLog;
import score.annotation.External;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package ibc.ics25.handler;

import ibc.icon.interfaces.IIBCConnection;
import ibc.icon.structs.messages.MsgConnectionOpenAck;
import ibc.icon.structs.messages.MsgConnectionOpenConfirm;
import ibc.icon.structs.messages.MsgConnectionOpenInit;
import ibc.icon.structs.messages.MsgConnectionOpenTry;
import icon.ibc.interfaces.IIBCConnection;
import icon.ibc.structs.messages.MsgConnectionOpenAck;
import icon.ibc.structs.messages.MsgConnectionOpenConfirm;
import icon.ibc.structs.messages.MsgConnectionOpenInit;
import icon.ibc.structs.messages.MsgConnectionOpenTry;
import score.annotation.EventLog;
import score.annotation.External;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import java.math.BigInteger;

import ibc.icon.interfaces.IIBCModule;
import ibc.icon.interfaces.IIBCPacket;
import ibc.icon.structs.messages.MsgPacketAcknowledgement;
import ibc.icon.structs.messages.MsgPacketRecv;
import ibc.icon.structs.messages.MsgPacketTimeout;
import ibc.icon.structs.messages.MsgRequestTimeoutPacket;
import icon.proto.core.channel.Packet;
import icon.ibc.interfaces.IIBCModule;
import icon.ibc.interfaces.IIBCPacket;
import icon.ibc.structs.messages.MsgPacketAcknowledgement;
import icon.ibc.structs.messages.MsgPacketRecv;
import icon.ibc.structs.messages.MsgPacketTimeout;
import icon.ibc.structs.messages.MsgRequestTimeoutPacket;
import score.Context;
import score.annotation.EventLog;
import score.annotation.External;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
import com.iconloop.score.test.Score;
import com.iconloop.score.test.ServiceManager;
import com.iconloop.score.test.TestBase;
import ibc.icon.interfaces.ILightClient;
import ibc.icon.interfaces.ILightClientScoreInterface;
import ibc.icon.structs.messages.MsgCreateClient;
import ibc.icon.structs.messages.MsgUpdateClient;

import ibc.icon.test.MockContract;
import icon.ibc.interfaces.ILightClient;
import icon.ibc.interfaces.ILightClientScoreInterface;
import icon.ibc.structs.messages.MsgCreateClient;
import icon.ibc.structs.messages.MsgUpdateClient;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.function.Executable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
import com.iconloop.score.test.ServiceManager;
import com.iconloop.score.test.TestBase;

import ibc.icon.interfaces.ILightClient;
import ibc.icon.interfaces.ILightClientScoreInterface;
import ibc.icon.score.util.ByteUtil;
import ibc.icon.structs.messages.MsgConnectionOpenAck;
import ibc.icon.structs.messages.MsgConnectionOpenConfirm;
import ibc.icon.structs.messages.MsgConnectionOpenInit;
import ibc.icon.structs.messages.MsgConnectionOpenTry;
import ibc.icon.test.MockContract;
import ibc.ics24.host.IBCCommitment;
import icon.ibc.interfaces.ILightClient;
import icon.ibc.interfaces.ILightClientScoreInterface;
import icon.ibc.structs.messages.MsgConnectionOpenAck;
import icon.ibc.structs.messages.MsgConnectionOpenConfirm;
import icon.ibc.structs.messages.MsgConnectionOpenInit;
import icon.ibc.structs.messages.MsgConnectionOpenTry;
import score.Address;
import test.proto.core.client.Client.Height;
import test.proto.core.connection.Connection.ConnectionEnd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
import com.iconloop.score.test.ServiceManager;
import com.iconloop.score.test.TestBase;

import ibc.icon.interfaces.ILightClient;
import ibc.icon.interfaces.ILightClientScoreInterface;
import ibc.icon.score.util.ByteUtil;
import ibc.icon.structs.messages.MsgChannelCloseConfirm;
import ibc.icon.structs.messages.MsgChannelCloseInit;
import ibc.icon.structs.messages.MsgChannelOpenAck;
import ibc.icon.structs.messages.MsgChannelOpenConfirm;
import ibc.icon.structs.messages.MsgChannelOpenInit;
import ibc.icon.structs.messages.MsgChannelOpenTry;
import ibc.icon.test.MockContract;
import ibc.ics03.connection.IBCConnection;
import ibc.ics24.host.IBCCommitment;
import icon.ibc.interfaces.ILightClient;
import icon.ibc.interfaces.ILightClientScoreInterface;
import icon.ibc.structs.messages.MsgChannelCloseConfirm;
import icon.ibc.structs.messages.MsgChannelCloseInit;
import icon.ibc.structs.messages.MsgChannelOpenAck;
import icon.ibc.structs.messages.MsgChannelOpenConfirm;
import icon.ibc.structs.messages.MsgChannelOpenInit;
import icon.ibc.structs.messages.MsgChannelOpenTry;
import score.Address;
import test.proto.core.channel.ChannelOuterClass.Channel;
import test.proto.core.channel.ChannelOuterClass.Channel.Counterparty;
Expand Down
Loading

0 comments on commit 1d8f528

Please sign in to comment.