Skip to content

Commit

Permalink
fix: resolve merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
sherpalden committed Nov 29, 2024
2 parents bdd5f01 + 0971607 commit b12625a
Show file tree
Hide file tree
Showing 58 changed files with 2,710 additions and 1,059 deletions.
765 changes: 11 additions & 754 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[workspace]
members = [
"contracts/cosmwasm-vm/*",
"contracts/soroban/contracts/*",
"contracts/soroban/libs/*"
"contracts/cosmwasm-vm/*"
]

[workspace.package]
Expand Down Expand Up @@ -38,8 +36,6 @@ cw-common={ git="https://github.com/icon-project/IBC-Integration.git", branch =
cw-mock-dapp = {path="contracts/cosmwasm-vm/cw-mock-dapp"}
cw-mock-dapp-multi = { path="contracts/cosmwasm-vm/cw-mock-dapp-multi"}

soroban-sdk = "21.6.0"

[profile.release]
opt-level = 'z'
debug = false
Expand Down
41 changes: 41 additions & 0 deletions contracts/javascore/aggregator/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version = '0.1.0'

dependencies {
testImplementation 'foundation.icon:javaee-unittest:0.11.1'
testImplementation project(':test-lib')
}

test {
useJUnitPlatform()
finalizedBy jacocoTestReport
}

optimizedJar {
mainClassName = 'relay.aggregator.RelayAggregator'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}

deployJar {
endpoints {
lisbon {
uri = 'https://lisbon.net.solidwallet.io/api/v3'
nid = 0x2
}
local {
uri = 'http://localhost:9082/api/v3'
nid = 0x3
}
mainnet {
uri = 'https://ctz.solidwallet.io/api/v3'
nid = 0x1
}
}
keystore = rootProject.hasProperty('keystoreName') ? "$keystoreName" : ''
password = rootProject.hasProperty('keystorePass') ? "$keystorePass" : ''
parameters {
arg('_admin', "hxb6b5791be0b5ef67063b3c10b840fb81514db2fd")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
package relay.aggregator;

import java.math.BigInteger;

import score.Context;
import score.ObjectReader;
import score.ObjectWriter;

public class Packet {

/**
* The ID of the source network (chain) from where the packet originated.
*/
private final String srcNetwork;

/**
* The contract address on the source network (chain).
*/
private final String srcContractAddress;

/**
* The sequence number of the packet in the source network (chain).
*/
private final BigInteger srcSn;

/**
* The source height of the packet in the source network (chain).
*/
private final BigInteger srcHeight;

/**
* The ID of the destination network (chain) where the packet is being sent.
*/
private final String dstNetwork;

/**
* The contract address on the destination network (chain).
*/
private final String dstContractAddress;

/**
* The payload data associated with this packet.
*/
private final byte[] data;

/**
* Constructs a new {@code Packet} object with the specified {@code PacketID},
* destination network, and data.
* All parameters must be non-null.
*
* @param id the unique identifier for the packet.
* @param dstNetwork the ID of the destination network (chain).
* @param data the payload data for this packet.
* @throws IllegalArgumentException if {@code srcNetwork},
* {@code srcContractAddress}, {@code srcSn},
* {@code srcHeight},
* {@code dstNetwork},
* {@code dstContractAddress}, or {@code data}
* is
* {@code null}.
*/
public Packet(String srcNetwork, String srcContractAddress, BigInteger srcSn, BigInteger srcHeight,
String dstNetwork, String dstContractAddress,
byte[] data) {
Boolean isIllegalArg = srcNetwork == null || srcContractAddress == null || srcSn == null
|| srcHeight == null || dstNetwork == null || dstContractAddress == null || data == null;
Context.require(!isIllegalArg,
"srcNetwork, contractAddress, srcSn, srcHeight, dstNetwork, and data cannot be null");
if (isIllegalArg) {
}
this.srcNetwork = srcNetwork;
this.srcContractAddress = srcContractAddress;
this.srcSn = srcSn;
this.srcHeight = srcHeight;
this.dstNetwork = dstNetwork;
this.dstContractAddress = dstContractAddress;
this.data = data;
}

public String getId() {
return createId(this.srcNetwork, this.srcContractAddress, this.srcSn);
}

public static String createId(String srcNetwork, String contractAddress, BigInteger srcSn) {
return srcNetwork + "/" + contractAddress + "/" + srcSn.toString();
}

/**
* Returns the source network (chain) from where the packet originated.
*
* @return the source network ID.
*/
public String getSrcNetwork() {
return srcNetwork;
}

/**
* Returns the contract address on the source network (chain).
*
* @return the source contract address.
*/
public String getSrcContractAddress() {
return srcContractAddress;
}

/**
* Returns the sequence number of the packet in the source network (chain).
*
* @return the sequence number.
*/
public BigInteger getSrcSn() {
return srcSn;
}

/**
* Returns the height of the packet in the source network (chain).
*
* @return the source height.
*/
public BigInteger getSrcHeight() {
return srcHeight;
}

/**
* Returns the destination network (chain) where the packet is being sent.
*
* @return the destination network ID.
*/
public String getDstNetwork() {
return dstNetwork;
}

/**
* Returns the contract address on the destination network (chain).
*
* @return the destination contract address.
*/
public String getDstContractAddress() {
return dstContractAddress;
}

/**
* Returns a copy of the data associated with this packet.
*
* @return a byte array containing the packet data.
*/
public byte[] getData() {
return data;
}

public static void writeObject(ObjectWriter w, Packet p) {
w.beginList(7);
w.write(p.srcNetwork);
w.write(p.srcContractAddress);
w.write(p.srcSn);
w.write(p.srcHeight);
w.write(p.dstNetwork);
w.write(p.dstContractAddress);
w.writeNullable(p.data);
w.end();
}

public static Packet readObject(ObjectReader r) {
r.beginList();
Packet p = new Packet(
r.readString(),
r.readString(),
r.readBigInteger(),
r.readBigInteger(),
r.readString(),
r.readString(),
r.readNullable(byte[].class));
r.end();
return p;
}
}
Loading

0 comments on commit b12625a

Please sign in to comment.