Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Pending
- feat: sort `ScMap` entries by key in `Scv.toMap` following Soroban runtime ordering rules, as the network requires ScMap keys to be in ascending order. `Scv.toMap` now accepts `Map<SCVal, SCVal>`; the previous `toMap(LinkedHashMap<SCVal, SCVal>)` overload is deprecated.
- feat: add `closeTime`, `headerXdr`, and `metadataXdr` to `GetLatestLedgerResponse`.
- chore: bump [stellar-xdr](https://github.com/stellar/stellar-xdr) to v25.0.

## 2.2.3

Expand Down
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# XDR files from https://github.com/stellar/stellar-xdr
XDRS = xdr/Stellar-SCP.x \
xdr/Stellar-ledger-entries.x \
xdr/Stellar-ledger.x \
xdr/Stellar-overlay.x \
xdr/Stellar-transaction.x \
xdr/Stellar-types.x \
xdr/Stellar-contract-config-setting.x \
xdr/Stellar-contract-env-meta.x \
xdr/Stellar-contract-meta.x \
xdr/Stellar-contract-spec.x \
xdr/Stellar-contract.x \
xdr/Stellar-exporter.x \
xdr/Stellar-internal.x \
xdr/Stellar-contract-config-setting.x \
xdr/Stellar-exporter.x
xdr/Stellar-ledger-entries.x \
xdr/Stellar-ledger.x \
xdr/Stellar-overlay.x \
xdr/Stellar-transaction.x \
xdr/Stellar-types.x

# stellar-xdr commit to use, see https://github.com/stellar/stellar-xdr
XDR_COMMIT=4b7a2ef7931ab2ca2499be68d849f38190b443ca
XDR_COMMIT=0a621ec7811db000a60efae5b35f78dee3aa2533

.PHONY: xdr xdr-clean xdr-update xdr-generator-test xdr-generator-update-snapshots

Expand Down
80 changes: 78 additions & 2 deletions src/main/java/org/stellar/sdk/xdr/ContractCostType.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,38 @@
* // Cost of performing BLS12-381 scalar element exponentiation
* Bls12381FrPow = 68,
* // Cost of performing BLS12-381 scalar element inversion
* Bls12381FrInv = 69
* Bls12381FrInv = 69,
*
* // Cost of encoding a BN254 Fp (base field element)
* Bn254EncodeFp = 70,
* // Cost of decoding a BN254 Fp (base field element)
* Bn254DecodeFp = 71,
* // Cost of checking a G1 point lies on the curve
* Bn254G1CheckPointOnCurve = 72,
* // Cost of checking a G2 point lies on the curve
* Bn254G2CheckPointOnCurve = 73,
* // Cost of checking a G2 point belongs to the correct subgroup
* Bn254G2CheckPointInSubgroup = 74,
* // Cost of converting a BN254 G1 point from projective to affine coordinates
* Bn254G1ProjectiveToAffine = 75,
* // Cost of performing BN254 G1 point addition
* Bn254G1Add = 76,
* // Cost of performing BN254 G1 scalar multiplication
* Bn254G1Mul = 77,
* // Cost of performing BN254 pairing operation
* Bn254Pairing = 78,
* // Cost of converting a BN254 scalar element from U256
* Bn254FrFromU256 = 79,
* // Cost of converting a BN254 scalar element to U256
* Bn254FrToU256 = 80,
* // // Cost of performing BN254 scalar element addition/subtraction
* Bn254FrAddSub = 81,
* // Cost of performing BN254 scalar element multiplication
* Bn254FrMul = 82,
* // Cost of performing BN254 scalar element exponentiation
* Bn254FrPow = 83,
* // Cost of performing BN254 scalar element inversion
* Bn254FrInv = 84
* };
* </pre>
*/
Expand Down Expand Up @@ -235,7 +266,22 @@ public enum ContractCostType implements XdrElement {
Bls12381FrAddSub(66),
Bls12381FrMul(67),
Bls12381FrPow(68),
Bls12381FrInv(69);
Bls12381FrInv(69),
Bn254EncodeFp(70),
Bn254DecodeFp(71),
Bn254G1CheckPointOnCurve(72),
Bn254G2CheckPointOnCurve(73),
Bn254G2CheckPointInSubgroup(74),
Bn254G1ProjectiveToAffine(75),
Bn254G1Add(76),
Bn254G1Mul(77),
Bn254Pairing(78),
Bn254FrFromU256(79),
Bn254FrToU256(80),
Bn254FrAddSub(81),
Bn254FrMul(82),
Bn254FrPow(83),
Bn254FrInv(84);

private final int value;

Expand Down Expand Up @@ -392,6 +438,36 @@ public static ContractCostType decode(XdrDataInputStream stream, int maxDepth)
return Bls12381FrPow;
case 69:
return Bls12381FrInv;
case 70:
return Bn254EncodeFp;
case 71:
return Bn254DecodeFp;
case 72:
return Bn254G1CheckPointOnCurve;
case 73:
return Bn254G2CheckPointOnCurve;
case 74:
return Bn254G2CheckPointInSubgroup;
case 75:
return Bn254G1ProjectiveToAffine;
case 76:
return Bn254G1Add;
case 77:
return Bn254G1Mul;
case 78:
return Bn254Pairing;
case 79:
return Bn254FrFromU256;
case 80:
return Bn254FrToU256;
case 81:
return Bn254FrAddSub;
case 82:
return Bn254FrMul;
case 83:
return Bn254FrPow;
case 84:
return Bn254FrInv;
default:
throw new IllegalArgumentException("Unknown enum value: " + value);
}
Expand Down
8 changes: 1 addition & 7 deletions src/main/java/org/stellar/sdk/xdr/SCSpecEventV0.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* string lib&lt;80&gt;;
* SCSymbol name;
* SCSymbol prefixTopics&lt;2&gt;;
* SCSpecEventParamV0 params&lt;50&gt;;
* SCSpecEventParamV0 params&lt;&gt;;
* SCSpecEventDataFormat dataFormat;
* };
* </pre>
Expand Down Expand Up @@ -59,9 +59,6 @@ public void encode(XdrDataOutputStream stream) throws IOException {
prefixTopics[i].encode(stream);
}
int paramsSize = getParams().length;
if (paramsSize > 50) {
throw new IOException("params size " + paramsSize + " exceeds max size 50");
}
stream.writeInt(paramsSize);
for (int i = 0; i < paramsSize; i++) {
params[i].encode(stream);
Expand Down Expand Up @@ -101,9 +98,6 @@ public static SCSpecEventV0 decode(XdrDataInputStream stream, int maxDepth) thro
if (paramsSize < 0) {
throw new IOException("params size " + paramsSize + " is negative");
}
if (paramsSize > 50) {
throw new IOException("params size " + paramsSize + " exceeds max size 50");
}
int paramsRemainingInputLen = stream.getRemainingInputLen();
if (paramsRemainingInputLen >= 0 && paramsRemainingInputLen < paramsSize) {
throw new IOException(
Expand Down
8 changes: 1 addition & 7 deletions src/main/java/org/stellar/sdk/xdr/SCSpecFunctionV0.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* {
* string doc&lt;SC_SPEC_DOC_LIMIT&gt;;
* SCSymbol name;
* SCSpecFunctionInputV0 inputs&lt;10&gt;;
* SCSpecFunctionInputV0 inputs&lt;&gt;;
* SCSpecTypeDef outputs&lt;1&gt;;
* };
* </pre>
Expand All @@ -42,9 +42,6 @@ public void encode(XdrDataOutputStream stream) throws IOException {
doc.encode(stream);
name.encode(stream);
int inputsSize = getInputs().length;
if (inputsSize > 10) {
throw new IOException("inputs size " + inputsSize + " exceeds max size 10");
}
stream.writeInt(inputsSize);
for (int i = 0; i < inputsSize; i++) {
inputs[i].encode(stream);
Expand Down Expand Up @@ -72,9 +69,6 @@ public static SCSpecFunctionV0 decode(XdrDataInputStream stream, int maxDepth)
if (inputsSize < 0) {
throw new IOException("inputs size " + inputsSize + " is negative");
}
if (inputsSize > 10) {
throw new IOException("inputs size " + inputsSize + " exceeds max size 10");
}
int inputsRemainingInputLen = stream.getRemainingInputLen();
if (inputsRemainingInputLen >= 0 && inputsRemainingInputLen < inputsSize) {
throw new IOException(
Expand Down
8 changes: 1 addition & 7 deletions src/main/java/org/stellar/sdk/xdr/SCSpecUDTEnumV0.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* string doc&lt;SC_SPEC_DOC_LIMIT&gt;;
* string lib&lt;80&gt;;
* string name&lt;60&gt;;
* SCSpecUDTEnumCaseV0 cases&lt;50&gt;;
* SCSpecUDTEnumCaseV0 cases&lt;&gt;;
* };
* </pre>
*/
Expand Down Expand Up @@ -51,9 +51,6 @@ public void encode(XdrDataOutputStream stream) throws IOException {
}
name.encode(stream);
int casesSize = getCases().length;
if (casesSize > 50) {
throw new IOException("cases size " + casesSize + " exceeds max size 50");
}
stream.writeInt(casesSize);
for (int i = 0; i < casesSize; i++) {
cases[i].encode(stream);
Expand All @@ -73,9 +70,6 @@ public static SCSpecUDTEnumV0 decode(XdrDataInputStream stream, int maxDepth) th
if (casesSize < 0) {
throw new IOException("cases size " + casesSize + " is negative");
}
if (casesSize > 50) {
throw new IOException("cases size " + casesSize + " exceeds max size 50");
}
int casesRemainingInputLen = stream.getRemainingInputLen();
if (casesRemainingInputLen >= 0 && casesRemainingInputLen < casesSize) {
throw new IOException(
Expand Down
8 changes: 1 addition & 7 deletions src/main/java/org/stellar/sdk/xdr/SCSpecUDTErrorEnumV0.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* string doc&lt;SC_SPEC_DOC_LIMIT&gt;;
* string lib&lt;80&gt;;
* string name&lt;60&gt;;
* SCSpecUDTErrorEnumCaseV0 cases&lt;50&gt;;
* SCSpecUDTErrorEnumCaseV0 cases&lt;&gt;;
* };
* </pre>
*/
Expand Down Expand Up @@ -51,9 +51,6 @@ public void encode(XdrDataOutputStream stream) throws IOException {
}
name.encode(stream);
int casesSize = getCases().length;
if (casesSize > 50) {
throw new IOException("cases size " + casesSize + " exceeds max size 50");
}
stream.writeInt(casesSize);
for (int i = 0; i < casesSize; i++) {
cases[i].encode(stream);
Expand All @@ -75,9 +72,6 @@ public static SCSpecUDTErrorEnumV0 decode(XdrDataInputStream stream, int maxDept
if (casesSize < 0) {
throw new IOException("cases size " + casesSize + " is negative");
}
if (casesSize > 50) {
throw new IOException("cases size " + casesSize + " exceeds max size 50");
}
int casesRemainingInputLen = stream.getRemainingInputLen();
if (casesRemainingInputLen >= 0 && casesRemainingInputLen < casesSize) {
throw new IOException(
Expand Down
8 changes: 1 addition & 7 deletions src/main/java/org/stellar/sdk/xdr/SCSpecUDTStructV0.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* string doc&lt;SC_SPEC_DOC_LIMIT&gt;;
* string lib&lt;80&gt;;
* string name&lt;60&gt;;
* SCSpecUDTStructFieldV0 fields&lt;40&gt;;
* SCSpecUDTStructFieldV0 fields&lt;&gt;;
* };
* </pre>
*/
Expand Down Expand Up @@ -51,9 +51,6 @@ public void encode(XdrDataOutputStream stream) throws IOException {
}
name.encode(stream);
int fieldsSize = getFields().length;
if (fieldsSize > 40) {
throw new IOException("fields size " + fieldsSize + " exceeds max size 40");
}
stream.writeInt(fieldsSize);
for (int i = 0; i < fieldsSize; i++) {
fields[i].encode(stream);
Expand All @@ -74,9 +71,6 @@ public static SCSpecUDTStructV0 decode(XdrDataInputStream stream, int maxDepth)
if (fieldsSize < 0) {
throw new IOException("fields size " + fieldsSize + " is negative");
}
if (fieldsSize > 40) {
throw new IOException("fields size " + fieldsSize + " exceeds max size 40");
}
int fieldsRemainingInputLen = stream.getRemainingInputLen();
if (fieldsRemainingInputLen >= 0 && fieldsRemainingInputLen < fieldsSize) {
throw new IOException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* {
* string doc&lt;SC_SPEC_DOC_LIMIT&gt;;
* string name&lt;60&gt;;
* SCSpecTypeDef type&lt;12&gt;;
* SCSpecTypeDef type&lt;&gt;;
* };
* </pre>
*/
Expand All @@ -44,9 +44,6 @@ public void encode(XdrDataOutputStream stream) throws IOException {
}
name.encode(stream);
int typeSize = getType().length;
if (typeSize > 12) {
throw new IOException("type size " + typeSize + " exceeds max size 12");
}
stream.writeInt(typeSize);
for (int i = 0; i < typeSize; i++) {
type[i].encode(stream);
Expand All @@ -67,9 +64,6 @@ public static SCSpecUDTUnionCaseTupleV0 decode(XdrDataInputStream stream, int ma
if (typeSize < 0) {
throw new IOException("type size " + typeSize + " is negative");
}
if (typeSize > 12) {
throw new IOException("type size " + typeSize + " exceeds max size 12");
}
int typeRemainingInputLen = stream.getRemainingInputLen();
if (typeRemainingInputLen >= 0 && typeRemainingInputLen < typeSize) {
throw new IOException(
Expand Down
8 changes: 1 addition & 7 deletions src/main/java/org/stellar/sdk/xdr/SCSpecUDTUnionV0.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* string doc&lt;SC_SPEC_DOC_LIMIT&gt;;
* string lib&lt;80&gt;;
* string name&lt;60&gt;;
* SCSpecUDTUnionCaseV0 cases&lt;50&gt;;
* SCSpecUDTUnionCaseV0 cases&lt;&gt;;
* };
* </pre>
*/
Expand Down Expand Up @@ -51,9 +51,6 @@ public void encode(XdrDataOutputStream stream) throws IOException {
}
name.encode(stream);
int casesSize = getCases().length;
if (casesSize > 50) {
throw new IOException("cases size " + casesSize + " exceeds max size 50");
}
stream.writeInt(casesSize);
for (int i = 0; i < casesSize; i++) {
cases[i].encode(stream);
Expand All @@ -74,9 +71,6 @@ public static SCSpecUDTUnionV0 decode(XdrDataInputStream stream, int maxDepth)
if (casesSize < 0) {
throw new IOException("cases size " + casesSize + " is negative");
}
if (casesSize > 50) {
throw new IOException("cases size " + casesSize + " exceeds max size 50");
}
int casesRemainingInputLen = stream.getRemainingInputLen();
if (casesRemainingInputLen >= 0 && casesRemainingInputLen < casesSize) {
throw new IOException(
Expand Down
4 changes: 2 additions & 2 deletions xdr/Stellar-SCP.x
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ struct SCPEnvelope
Signature signature;
};

// supports things like: A,B,C,(D,E,F),(G,H,(I,J,K,L))
// only allows 2 levels of nesting
// supports things like: A,B,(C,D,E),(F,G,(H,I,(J,K,(L,M))))
// only allows 4 levels of nesting
struct SCPQuorumSet
{
uint32 threshold;
Expand Down
33 changes: 32 additions & 1 deletion xdr/Stellar-contract-config-setting.x
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,38 @@ enum ContractCostType {
// Cost of performing BLS12-381 scalar element exponentiation
Bls12381FrPow = 68,
// Cost of performing BLS12-381 scalar element inversion
Bls12381FrInv = 69
Bls12381FrInv = 69,

// Cost of encoding a BN254 Fp (base field element)
Bn254EncodeFp = 70,
// Cost of decoding a BN254 Fp (base field element)
Bn254DecodeFp = 71,
// Cost of checking a G1 point lies on the curve
Bn254G1CheckPointOnCurve = 72,
// Cost of checking a G2 point lies on the curve
Bn254G2CheckPointOnCurve = 73,
// Cost of checking a G2 point belongs to the correct subgroup
Bn254G2CheckPointInSubgroup = 74,
// Cost of converting a BN254 G1 point from projective to affine coordinates
Bn254G1ProjectiveToAffine = 75,
// Cost of performing BN254 G1 point addition
Bn254G1Add = 76,
// Cost of performing BN254 G1 scalar multiplication
Bn254G1Mul = 77,
// Cost of performing BN254 pairing operation
Bn254Pairing = 78,
// Cost of converting a BN254 scalar element from U256
Bn254FrFromU256 = 79,
// Cost of converting a BN254 scalar element to U256
Bn254FrToU256 = 80,
// // Cost of performing BN254 scalar element addition/subtraction
Bn254FrAddSub = 81,
// Cost of performing BN254 scalar element multiplication
Bn254FrMul = 82,
// Cost of performing BN254 scalar element exponentiation
Bn254FrPow = 83,
// Cost of performing BN254 scalar element inversion
Bn254FrInv = 84
};

struct ContractCostParamEntry {
Expand Down
Loading
Loading