From 9dab1fe289a63dcf1b479ae2821d58e41b1a4e0a Mon Sep 17 00:00:00 2001 From: George Date: Thu, 12 Sep 2024 12:13:12 -0700 Subject: [PATCH] Upgrade XDR to the latest tips of `curr` and `next` branches (#774) --- Makefile | 4 +- src/generated/curr_generated.js | 110 +++++++++++- src/generated/next_generated.js | 117 +++++++++++-- types/curr.d.ts | 150 ++++++++++++++++- types/next.d.ts | 185 ++++++++++++++++++++- xdr/curr/Stellar-contract-config-setting.x | 53 +++++- xdr/curr/Stellar-contract-env-meta.x | 5 +- xdr/curr/Stellar-transaction.x | 10 +- xdr/next/Stellar-contract-config-setting.x | 53 +++++- xdr/next/Stellar-contract-env-meta.x | 5 +- xdr/next/Stellar-transaction.x | 10 +- 11 files changed, 655 insertions(+), 47 deletions(-) diff --git a/Makefile b/Makefile index 626577828..85313fdd5 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -XDR_BASE_URL_CURR=https://github.com/stellar/stellar-xdr/raw/4ec28d95dd84b109253e22b151314478d6f00522 +XDR_BASE_URL_CURR=https://github.com/stellar/stellar-xdr/raw/529d5176f24c73eeccfa5eba481d4e89c19b1181 XDR_BASE_LOCAL_CURR=xdr/curr XDR_FILES_CURR= \ Stellar-SCP.x \ @@ -14,7 +14,7 @@ XDR_FILES_CURR= \ Stellar-contract-config-setting.x XDR_FILES_LOCAL_CURR=$(addprefix xdr/curr/,$(XDR_FILES_CURR)) -XDR_BASE_URL_NEXT=https://github.com/stellar/stellar-xdr/raw/86b4ff573c3e9a475f9280b97645cc75e2c75b6e +XDR_BASE_URL_NEXT=https://github.com/stellar/stellar-xdr/raw/8c88608d0a20b01873056a5ec13be245e1f2aa27 XDR_BASE_LOCAL_NEXT=xdr/next XDR_FILES_NEXT= \ Stellar-SCP.x \ diff --git a/src/generated/curr_generated.js b/src/generated/curr_generated.js index 9a55b0a31..db4b4f403 100644 --- a/src/generated/curr_generated.js +++ b/src/generated/curr_generated.js @@ -1,4 +1,4 @@ -// Automatically generated by xdrgen on 2024-08-23T12:09:00-08:00 +// Automatically generated by xdrgen on 2024-09-12T11:09:00-08:00 // DO NOT EDIT or your changes may be overwritten /* jshint maxstatements:2147483647 */ @@ -5213,12 +5213,16 @@ xdr.enum("SorobanAuthorizedFunctionType", { // { // case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN: // InvokeContractArgs contractFn; -// // This variant of auth payload for creating new contract instances is no -// // longer accepted after protocol 22. +// // This variant of auth payload for creating new contract instances +// // doesn't allow specifying the constructor arguments, creating contracts +// // with constructors that take arguments is only possible by authorizing +// // `SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN` +// // (protocol 22+). // case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: // CreateContractArgs createContractHostFn; // // This variant of auth payload for creating new contract instances -// // is only accepted in and after protocol 22. +// // is only accepted in and after protocol 22. It allows authorizing the +// // contract constructor arguments. // case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN: // CreateContractArgsV2 createContractV2HostFn; // }; @@ -9588,12 +9592,28 @@ xdr.enum("ScEnvMetaKind", { scEnvMetaKindInterfaceVersion: 0, }); +// === xdr source ============================================================ +// +// struct { +// uint32 protocol; +// uint32 preRelease; +// } +// +// =========================================================================== +xdr.struct("ScEnvMetaEntryInterfaceVersion", [ + ["protocol", xdr.lookup("Uint32")], + ["preRelease", xdr.lookup("Uint32")], +]); + // === xdr source ============================================================ // // union SCEnvMetaEntry switch (SCEnvMetaKind kind) // { // case SC_ENV_META_KIND_INTERFACE_VERSION: -// uint64 interfaceVersion; +// struct { +// uint32 protocol; +// uint32 preRelease; +// } interfaceVersion; // }; // // =========================================================================== @@ -9604,7 +9624,7 @@ xdr.union("ScEnvMetaEntry", { ["scEnvMetaKindInterfaceVersion", "interfaceVersion"], ], arms: { - interfaceVersion: xdr.lookup("Uint64"), + interfaceVersion: xdr.lookup("ScEnvMetaEntryInterfaceVersion"), }, }); @@ -10417,7 +10437,58 @@ xdr.struct("ConfigSettingContractBandwidthV0", [ // // point on a 256-bit elliptic curve // Sec1DecodePointUncompressed = 43, // // Cost of verifying an ECDSA Secp256r1 signature -// VerifyEcdsaSecp256r1Sig = 44 +// VerifyEcdsaSecp256r1Sig = 44, +// +// // Cost of encoding a BLS12-381 Fp (base field element) +// Bls12381EncodeFp = 45, +// // Cost of decoding a BLS12-381 Fp (base field element) +// Bls12381DecodeFp = 46, +// // Cost of checking a G1 point lies on the curve +// Bls12381G1CheckPointOnCurve = 47, +// // Cost of checking a G1 point belongs to the correct subgroup +// Bls12381G1CheckPointInSubgroup = 48, +// // Cost of checking a G2 point lies on the curve +// Bls12381G2CheckPointOnCurve = 49, +// // Cost of checking a G2 point belongs to the correct subgroup +// Bls12381G2CheckPointInSubgroup = 50, +// // Cost of converting a BLS12-381 G1 point from projective to affine coordinates +// Bls12381G1ProjectiveToAffine = 51, +// // Cost of converting a BLS12-381 G2 point from projective to affine coordinates +// Bls12381G2ProjectiveToAffine = 52, +// // Cost of performing BLS12-381 G1 point addition +// Bls12381G1Add = 53, +// // Cost of performing BLS12-381 G1 scalar multiplication +// Bls12381G1Mul = 54, +// // Cost of performing BLS12-381 G1 multi-scalar multiplication (MSM) +// Bls12381G1Msm = 55, +// // Cost of mapping a BLS12-381 Fp field element to a G1 point +// Bls12381MapFpToG1 = 56, +// // Cost of hashing to a BLS12-381 G1 point +// Bls12381HashToG1 = 57, +// // Cost of performing BLS12-381 G2 point addition +// Bls12381G2Add = 58, +// // Cost of performing BLS12-381 G2 scalar multiplication +// Bls12381G2Mul = 59, +// // Cost of performing BLS12-381 G2 multi-scalar multiplication (MSM) +// Bls12381G2Msm = 60, +// // Cost of mapping a BLS12-381 Fp2 field element to a G2 point +// Bls12381MapFp2ToG2 = 61, +// // Cost of hashing to a BLS12-381 G2 point +// Bls12381HashToG2 = 62, +// // Cost of performing BLS12-381 pairing operation +// Bls12381Pairing = 63, +// // Cost of converting a BLS12-381 scalar element from U256 +// Bls12381FrFromU256 = 64, +// // Cost of converting a BLS12-381 scalar element to U256 +// Bls12381FrToU256 = 65, +// // Cost of performing BLS12-381 scalar element addition/subtraction +// Bls12381FrAddSub = 66, +// // Cost of performing BLS12-381 scalar element multiplication +// Bls12381FrMul = 67, +// // Cost of performing BLS12-381 scalar element exponentiation +// Bls12381FrPow = 68, +// // Cost of performing BLS12-381 scalar element inversion +// Bls12381FrInv = 69 // }; // // =========================================================================== @@ -10467,6 +10538,31 @@ xdr.enum("ContractCostType", { instantiateWasmDataSegmentBytes: 42, sec1DecodePointUncompressed: 43, verifyEcdsaSecp256r1Sig: 44, + bls12381EncodeFp: 45, + bls12381DecodeFp: 46, + bls12381G1CheckPointOnCurve: 47, + bls12381G1CheckPointInSubgroup: 48, + bls12381G2CheckPointOnCurve: 49, + bls12381G2CheckPointInSubgroup: 50, + bls12381G1ProjectiveToAffine: 51, + bls12381G2ProjectiveToAffine: 52, + bls12381G1Add: 53, + bls12381G1Mul: 54, + bls12381G1Msm: 55, + bls12381MapFpToG1: 56, + bls12381HashToG1: 57, + bls12381G2Add: 58, + bls12381G2Mul: 59, + bls12381G2Msm: 60, + bls12381MapFp2ToG2: 61, + bls12381HashToG2: 62, + bls12381Pairing: 63, + bls12381FrFromU256: 64, + bls12381FrToU256: 65, + bls12381FrAddSub: 66, + bls12381FrMul: 67, + bls12381FrPow: 68, + bls12381FrInv: 69, }); // === xdr source ============================================================ diff --git a/src/generated/next_generated.js b/src/generated/next_generated.js index 10570406c..fe8ce8690 100644 --- a/src/generated/next_generated.js +++ b/src/generated/next_generated.js @@ -1,4 +1,4 @@ -// Automatically generated by xdrgen on 2024-08-23T12:09:00-08:00 +// Automatically generated by xdrgen on 2024-09-12T11:09:00-08:00 // DO NOT EDIT or your changes may be overwritten /* jshint maxstatements:2147483647 */ @@ -15,13 +15,6 @@ var types = XDR.config(xdr => { const SCSYMBOL_LIMIT = 32; const SC_SPEC_DOC_LIMIT = 1024; -// === xdr source ============================================================ -// -// typedef opaque Value<>; -// -// =========================================================================== -xdr.typedef("Value", xdr.varOpaque()); - // === xdr source ============================================================ // // struct SCPBallot @@ -5238,12 +5231,16 @@ xdr.enum("SorobanAuthorizedFunctionType", { // { // case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN: // InvokeContractArgs contractFn; -// // This variant of auth payload for creating new contract instances is no -// // longer accepted after protocol 22. +// // This variant of auth payload for creating new contract instances +// // doesn't allow specifying the constructor arguments, creating contracts +// // with constructors that take arguments is only possible by authorizing +// // `SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN` +// // (protocol 22+). // case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: // CreateContractArgs createContractHostFn; // // This variant of auth payload for creating new contract instances -// // is only accepted in and after protocol 22. +// // is only accepted in and after protocol 22. It allows authorizing the +// // contract constructor arguments. // case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN: // CreateContractArgsV2 createContractV2HostFn; // }; @@ -9642,12 +9639,28 @@ xdr.enum("ScEnvMetaKind", { scEnvMetaKindInterfaceVersion: 0, }); +// === xdr source ============================================================ +// +// struct { +// uint32 protocol; +// uint32 preRelease; +// } +// +// =========================================================================== +xdr.struct("ScEnvMetaEntryInterfaceVersion", [ + ["protocol", xdr.lookup("Uint32")], + ["preRelease", xdr.lookup("Uint32")], +]); + // === xdr source ============================================================ // // union SCEnvMetaEntry switch (SCEnvMetaKind kind) // { // case SC_ENV_META_KIND_INTERFACE_VERSION: -// uint64 interfaceVersion; +// struct { +// uint32 protocol; +// uint32 preRelease; +// } interfaceVersion; // }; // // =========================================================================== @@ -9658,7 +9671,7 @@ xdr.union("ScEnvMetaEntry", { ["scEnvMetaKindInterfaceVersion", "interfaceVersion"], ], arms: { - interfaceVersion: xdr.lookup("Uint64"), + interfaceVersion: xdr.lookup("ScEnvMetaEntryInterfaceVersion"), }, }); @@ -10489,7 +10502,58 @@ xdr.struct("ConfigSettingContractBandwidthV0", [ // // point on a 256-bit elliptic curve // Sec1DecodePointUncompressed = 43, // // Cost of verifying an ECDSA Secp256r1 signature -// VerifyEcdsaSecp256r1Sig = 44 +// VerifyEcdsaSecp256r1Sig = 44, +// +// // Cost of encoding a BLS12-381 Fp (base field element) +// Bls12381EncodeFp = 45, +// // Cost of decoding a BLS12-381 Fp (base field element) +// Bls12381DecodeFp = 46, +// // Cost of checking a G1 point lies on the curve +// Bls12381G1CheckPointOnCurve = 47, +// // Cost of checking a G1 point belongs to the correct subgroup +// Bls12381G1CheckPointInSubgroup = 48, +// // Cost of checking a G2 point lies on the curve +// Bls12381G2CheckPointOnCurve = 49, +// // Cost of checking a G2 point belongs to the correct subgroup +// Bls12381G2CheckPointInSubgroup = 50, +// // Cost of converting a BLS12-381 G1 point from projective to affine coordinates +// Bls12381G1ProjectiveToAffine = 51, +// // Cost of converting a BLS12-381 G2 point from projective to affine coordinates +// Bls12381G2ProjectiveToAffine = 52, +// // Cost of performing BLS12-381 G1 point addition +// Bls12381G1Add = 53, +// // Cost of performing BLS12-381 G1 scalar multiplication +// Bls12381G1Mul = 54, +// // Cost of performing BLS12-381 G1 multi-scalar multiplication (MSM) +// Bls12381G1Msm = 55, +// // Cost of mapping a BLS12-381 Fp field element to a G1 point +// Bls12381MapFpToG1 = 56, +// // Cost of hashing to a BLS12-381 G1 point +// Bls12381HashToG1 = 57, +// // Cost of performing BLS12-381 G2 point addition +// Bls12381G2Add = 58, +// // Cost of performing BLS12-381 G2 scalar multiplication +// Bls12381G2Mul = 59, +// // Cost of performing BLS12-381 G2 multi-scalar multiplication (MSM) +// Bls12381G2Msm = 60, +// // Cost of mapping a BLS12-381 Fp2 field element to a G2 point +// Bls12381MapFp2ToG2 = 61, +// // Cost of hashing to a BLS12-381 G2 point +// Bls12381HashToG2 = 62, +// // Cost of performing BLS12-381 pairing operation +// Bls12381Pairing = 63, +// // Cost of converting a BLS12-381 scalar element from U256 +// Bls12381FrFromU256 = 64, +// // Cost of converting a BLS12-381 scalar element to U256 +// Bls12381FrToU256 = 65, +// // Cost of performing BLS12-381 scalar element addition/subtraction +// Bls12381FrAddSub = 66, +// // Cost of performing BLS12-381 scalar element multiplication +// Bls12381FrMul = 67, +// // Cost of performing BLS12-381 scalar element exponentiation +// Bls12381FrPow = 68, +// // Cost of performing BLS12-381 scalar element inversion +// Bls12381FrInv = 69 // }; // // =========================================================================== @@ -10539,6 +10603,31 @@ xdr.enum("ContractCostType", { instantiateWasmDataSegmentBytes: 42, sec1DecodePointUncompressed: 43, verifyEcdsaSecp256r1Sig: 44, + bls12381EncodeFp: 45, + bls12381DecodeFp: 46, + bls12381G1CheckPointOnCurve: 47, + bls12381G1CheckPointInSubgroup: 48, + bls12381G2CheckPointOnCurve: 49, + bls12381G2CheckPointInSubgroup: 50, + bls12381G1ProjectiveToAffine: 51, + bls12381G2ProjectiveToAffine: 52, + bls12381G1Add: 53, + bls12381G1Mul: 54, + bls12381G1Msm: 55, + bls12381MapFpToG1: 56, + bls12381HashToG1: 57, + bls12381G2Add: 58, + bls12381G2Mul: 59, + bls12381G2Msm: 60, + bls12381MapFp2ToG2: 61, + bls12381HashToG2: 62, + bls12381Pairing: 63, + bls12381FrFromU256: 64, + bls12381FrToU256: 65, + bls12381FrAddSub: 66, + bls12381FrMul: 67, + bls12381FrPow: 68, + bls12381FrInv: 69, }); // === xdr source ============================================================ diff --git a/types/curr.d.ts b/types/curr.d.ts index 0c4d18a81..beafaa43e 100644 --- a/types/curr.d.ts +++ b/types/curr.d.ts @@ -1,4 +1,4 @@ -// Automatically generated by xdrgen on 2024-08-23T12:09:00-08:00 +// Automatically generated by xdrgen on 2024-09-12T11:09:00-08:00 // DO NOT EDIT or your changes may be overwritten import { Operation } from './index'; @@ -2344,7 +2344,32 @@ export namespace xdr { | 'instantiateWasmExports' | 'instantiateWasmDataSegmentBytes' | 'sec1DecodePointUncompressed' - | 'verifyEcdsaSecp256r1Sig'; + | 'verifyEcdsaSecp256r1Sig' + | 'bls12381EncodeFp' + | 'bls12381DecodeFp' + | 'bls12381G1CheckPointOnCurve' + | 'bls12381G1CheckPointInSubgroup' + | 'bls12381G2CheckPointOnCurve' + | 'bls12381G2CheckPointInSubgroup' + | 'bls12381G1ProjectiveToAffine' + | 'bls12381G2ProjectiveToAffine' + | 'bls12381G1Add' + | 'bls12381G1Mul' + | 'bls12381G1Msm' + | 'bls12381MapFpToG1' + | 'bls12381HashToG1' + | 'bls12381G2Add' + | 'bls12381G2Mul' + | 'bls12381G2Msm' + | 'bls12381MapFp2ToG2' + | 'bls12381HashToG2' + | 'bls12381Pairing' + | 'bls12381FrFromU256' + | 'bls12381FrToU256' + | 'bls12381FrAddSub' + | 'bls12381FrMul' + | 'bls12381FrPow' + | 'bls12381FrInv'; readonly value: | 0 @@ -2391,7 +2416,32 @@ export namespace xdr { | 41 | 42 | 43 - | 44; + | 44 + | 45 + | 46 + | 47 + | 48 + | 49 + | 50 + | 51 + | 52 + | 53 + | 54 + | 55 + | 56 + | 57 + | 58 + | 59 + | 60 + | 61 + | 62 + | 63 + | 64 + | 65 + | 66 + | 67 + | 68 + | 69; static wasmInsnExec(): ContractCostType; @@ -2482,6 +2532,56 @@ export namespace xdr { static sec1DecodePointUncompressed(): ContractCostType; static verifyEcdsaSecp256r1Sig(): ContractCostType; + + static bls12381EncodeFp(): ContractCostType; + + static bls12381DecodeFp(): ContractCostType; + + static bls12381G1CheckPointOnCurve(): ContractCostType; + + static bls12381G1CheckPointInSubgroup(): ContractCostType; + + static bls12381G2CheckPointOnCurve(): ContractCostType; + + static bls12381G2CheckPointInSubgroup(): ContractCostType; + + static bls12381G1ProjectiveToAffine(): ContractCostType; + + static bls12381G2ProjectiveToAffine(): ContractCostType; + + static bls12381G1Add(): ContractCostType; + + static bls12381G1Mul(): ContractCostType; + + static bls12381G1Msm(): ContractCostType; + + static bls12381MapFpToG1(): ContractCostType; + + static bls12381HashToG1(): ContractCostType; + + static bls12381G2Add(): ContractCostType; + + static bls12381G2Mul(): ContractCostType; + + static bls12381G2Msm(): ContractCostType; + + static bls12381MapFp2ToG2(): ContractCostType; + + static bls12381HashToG2(): ContractCostType; + + static bls12381Pairing(): ContractCostType; + + static bls12381FrFromU256(): ContractCostType; + + static bls12381FrToU256(): ContractCostType; + + static bls12381FrAddSub(): ContractCostType; + + static bls12381FrMul(): ContractCostType; + + static bls12381FrPow(): ContractCostType; + + static bls12381FrInv(): ContractCostType; } class ConfigSettingId { @@ -9285,6 +9385,40 @@ export namespace xdr { static validateXDR(input: string, format: 'hex' | 'base64'): boolean; } + class ScEnvMetaEntryInterfaceVersion { + constructor(attributes: { protocol: number; preRelease: number }); + + protocol(value?: number): number; + + preRelease(value?: number): number; + + toXDR(format?: 'raw'): Buffer; + + toXDR(format: 'hex' | 'base64'): string; + + static read(io: Buffer): ScEnvMetaEntryInterfaceVersion; + + static write(value: ScEnvMetaEntryInterfaceVersion, io: Buffer): void; + + static isValid(value: ScEnvMetaEntryInterfaceVersion): boolean; + + static toXDR(value: ScEnvMetaEntryInterfaceVersion): Buffer; + + static fromXDR( + input: Buffer, + format?: 'raw', + ): ScEnvMetaEntryInterfaceVersion; + + static fromXDR( + input: string, + format: 'hex' | 'base64', + ): ScEnvMetaEntryInterfaceVersion; + + static validateXDR(input: Buffer, format?: 'raw'): boolean; + + static validateXDR(input: string, format: 'hex' | 'base64'): boolean; + } + class ScMetaV0 { constructor(attributes: { key: string | Buffer; val: string | Buffer }); @@ -15189,11 +15323,15 @@ export namespace xdr { class ScEnvMetaEntry { switch(): ScEnvMetaKind; - interfaceVersion(value?: Uint64): Uint64; + interfaceVersion( + value?: ScEnvMetaEntryInterfaceVersion, + ): ScEnvMetaEntryInterfaceVersion; - static scEnvMetaKindInterfaceVersion(value: Uint64): ScEnvMetaEntry; + static scEnvMetaKindInterfaceVersion( + value: ScEnvMetaEntryInterfaceVersion, + ): ScEnvMetaEntry; - value(): Uint64; + value(): ScEnvMetaEntryInterfaceVersion; toXDR(format?: 'raw'): Buffer; diff --git a/types/next.d.ts b/types/next.d.ts index 77510de84..ced3636f1 100644 --- a/types/next.d.ts +++ b/types/next.d.ts @@ -1,4 +1,4 @@ -// Automatically generated by xdrgen on 2024-08-23T12:09:00-08:00 +// Automatically generated by xdrgen on 2024-09-12T11:09:00-08:00 // DO NOT EDIT or your changes may be overwritten import { Operation } from './index'; @@ -89,7 +89,7 @@ export namespace xdr { unsigned: boolean; constructor( - values: string | bigint | number | Array, + values: string | bigint | number | (string | bigint | number)[], ); toXDR(format?: 'raw'): Buffer; @@ -133,7 +133,7 @@ export namespace xdr { unsigned: boolean; constructor( - values: string | bigint | number | Array, + values: string | bigint | number | (string | bigint | number)[], ); toXDR(format?: 'raw'): Buffer; @@ -2344,7 +2344,32 @@ export namespace xdr { | 'instantiateWasmExports' | 'instantiateWasmDataSegmentBytes' | 'sec1DecodePointUncompressed' - | 'verifyEcdsaSecp256r1Sig'; + | 'verifyEcdsaSecp256r1Sig' + | 'bls12381EncodeFp' + | 'bls12381DecodeFp' + | 'bls12381G1CheckPointOnCurve' + | 'bls12381G1CheckPointInSubgroup' + | 'bls12381G2CheckPointOnCurve' + | 'bls12381G2CheckPointInSubgroup' + | 'bls12381G1ProjectiveToAffine' + | 'bls12381G2ProjectiveToAffine' + | 'bls12381G1Add' + | 'bls12381G1Mul' + | 'bls12381G1Msm' + | 'bls12381MapFpToG1' + | 'bls12381HashToG1' + | 'bls12381G2Add' + | 'bls12381G2Mul' + | 'bls12381G2Msm' + | 'bls12381MapFp2ToG2' + | 'bls12381HashToG2' + | 'bls12381Pairing' + | 'bls12381FrFromU256' + | 'bls12381FrToU256' + | 'bls12381FrAddSub' + | 'bls12381FrMul' + | 'bls12381FrPow' + | 'bls12381FrInv'; readonly value: | 0 @@ -2391,7 +2416,32 @@ export namespace xdr { | 41 | 42 | 43 - | 44; + | 44 + | 45 + | 46 + | 47 + | 48 + | 49 + | 50 + | 51 + | 52 + | 53 + | 54 + | 55 + | 56 + | 57 + | 58 + | 59 + | 60 + | 61 + | 62 + | 63 + | 64 + | 65 + | 66 + | 67 + | 68 + | 69; static wasmInsnExec(): ContractCostType; @@ -2482,6 +2532,56 @@ export namespace xdr { static sec1DecodePointUncompressed(): ContractCostType; static verifyEcdsaSecp256r1Sig(): ContractCostType; + + static bls12381EncodeFp(): ContractCostType; + + static bls12381DecodeFp(): ContractCostType; + + static bls12381G1CheckPointOnCurve(): ContractCostType; + + static bls12381G1CheckPointInSubgroup(): ContractCostType; + + static bls12381G2CheckPointOnCurve(): ContractCostType; + + static bls12381G2CheckPointInSubgroup(): ContractCostType; + + static bls12381G1ProjectiveToAffine(): ContractCostType; + + static bls12381G2ProjectiveToAffine(): ContractCostType; + + static bls12381G1Add(): ContractCostType; + + static bls12381G1Mul(): ContractCostType; + + static bls12381G1Msm(): ContractCostType; + + static bls12381MapFpToG1(): ContractCostType; + + static bls12381HashToG1(): ContractCostType; + + static bls12381G2Add(): ContractCostType; + + static bls12381G2Mul(): ContractCostType; + + static bls12381G2Msm(): ContractCostType; + + static bls12381MapFp2ToG2(): ContractCostType; + + static bls12381HashToG2(): ContractCostType; + + static bls12381Pairing(): ContractCostType; + + static bls12381FrFromU256(): ContractCostType; + + static bls12381FrToU256(): ContractCostType; + + static bls12381FrAddSub(): ContractCostType; + + static bls12381FrMul(): ContractCostType; + + static bls12381FrPow(): ContractCostType; + + static bls12381FrInv(): ContractCostType; } class ConfigSettingId { @@ -7750,6 +7850,37 @@ export namespace xdr { static validateXDR(input: string, format: 'hex' | 'base64'): boolean; } + class Operation { + constructor(attributes: { + sourceAccount: null | MuxedAccount; + body: OperationBody; + }); + + sourceAccount(value?: null | MuxedAccount): null | MuxedAccount; + + body(value?: OperationBody): OperationBody; + + toXDR(format?: 'raw'): Buffer; + + toXDR(format: 'hex' | 'base64'): string; + + static read(io: Buffer): Operation; + + static write(value: Operation, io: Buffer): void; + + static isValid(value: Operation): boolean; + + static toXDR(value: Operation): Buffer; + + static fromXDR(input: Buffer, format?: 'raw'): Operation; + + static fromXDR(input: string, format: 'hex' | 'base64'): Operation; + + static validateXDR(input: Buffer, format?: 'raw'): boolean; + + static validateXDR(input: string, format: 'hex' | 'base64'): boolean; + } + class HashIdPreimageOperationId { constructor(attributes: { sourceAccount: AccountId; @@ -9341,6 +9472,40 @@ export namespace xdr { static validateXDR(input: string, format: 'hex' | 'base64'): boolean; } + class ScEnvMetaEntryInterfaceVersion { + constructor(attributes: { protocol: number; preRelease: number }); + + protocol(value?: number): number; + + preRelease(value?: number): number; + + toXDR(format?: 'raw'): Buffer; + + toXDR(format: 'hex' | 'base64'): string; + + static read(io: Buffer): ScEnvMetaEntryInterfaceVersion; + + static write(value: ScEnvMetaEntryInterfaceVersion, io: Buffer): void; + + static isValid(value: ScEnvMetaEntryInterfaceVersion): boolean; + + static toXDR(value: ScEnvMetaEntryInterfaceVersion): Buffer; + + static fromXDR( + input: Buffer, + format?: 'raw', + ): ScEnvMetaEntryInterfaceVersion; + + static fromXDR( + input: string, + format: 'hex' | 'base64', + ): ScEnvMetaEntryInterfaceVersion; + + static validateXDR(input: Buffer, format?: 'raw'): boolean; + + static validateXDR(input: string, format: 'hex' | 'base64'): boolean; + } + class ScMetaV0 { constructor(attributes: { key: string | Buffer; val: string | Buffer }); @@ -15319,11 +15484,15 @@ export namespace xdr { class ScEnvMetaEntry { switch(): ScEnvMetaKind; - interfaceVersion(value?: Uint64): Uint64; + interfaceVersion( + value?: ScEnvMetaEntryInterfaceVersion, + ): ScEnvMetaEntryInterfaceVersion; - static scEnvMetaKindInterfaceVersion(value: Uint64): ScEnvMetaEntry; + static scEnvMetaKindInterfaceVersion( + value: ScEnvMetaEntryInterfaceVersion, + ): ScEnvMetaEntry; - value(): Uint64; + value(): ScEnvMetaEntryInterfaceVersion; toXDR(format?: 'raw'): Buffer; diff --git a/xdr/curr/Stellar-contract-config-setting.x b/xdr/curr/Stellar-contract-config-setting.x index 52cc0224d..9f09c7b0e 100644 --- a/xdr/curr/Stellar-contract-config-setting.x +++ b/xdr/curr/Stellar-contract-config-setting.x @@ -188,7 +188,58 @@ enum ContractCostType { // point on a 256-bit elliptic curve Sec1DecodePointUncompressed = 43, // Cost of verifying an ECDSA Secp256r1 signature - VerifyEcdsaSecp256r1Sig = 44 + VerifyEcdsaSecp256r1Sig = 44, + + // Cost of encoding a BLS12-381 Fp (base field element) + Bls12381EncodeFp = 45, + // Cost of decoding a BLS12-381 Fp (base field element) + Bls12381DecodeFp = 46, + // Cost of checking a G1 point lies on the curve + Bls12381G1CheckPointOnCurve = 47, + // Cost of checking a G1 point belongs to the correct subgroup + Bls12381G1CheckPointInSubgroup = 48, + // Cost of checking a G2 point lies on the curve + Bls12381G2CheckPointOnCurve = 49, + // Cost of checking a G2 point belongs to the correct subgroup + Bls12381G2CheckPointInSubgroup = 50, + // Cost of converting a BLS12-381 G1 point from projective to affine coordinates + Bls12381G1ProjectiveToAffine = 51, + // Cost of converting a BLS12-381 G2 point from projective to affine coordinates + Bls12381G2ProjectiveToAffine = 52, + // Cost of performing BLS12-381 G1 point addition + Bls12381G1Add = 53, + // Cost of performing BLS12-381 G1 scalar multiplication + Bls12381G1Mul = 54, + // Cost of performing BLS12-381 G1 multi-scalar multiplication (MSM) + Bls12381G1Msm = 55, + // Cost of mapping a BLS12-381 Fp field element to a G1 point + Bls12381MapFpToG1 = 56, + // Cost of hashing to a BLS12-381 G1 point + Bls12381HashToG1 = 57, + // Cost of performing BLS12-381 G2 point addition + Bls12381G2Add = 58, + // Cost of performing BLS12-381 G2 scalar multiplication + Bls12381G2Mul = 59, + // Cost of performing BLS12-381 G2 multi-scalar multiplication (MSM) + Bls12381G2Msm = 60, + // Cost of mapping a BLS12-381 Fp2 field element to a G2 point + Bls12381MapFp2ToG2 = 61, + // Cost of hashing to a BLS12-381 G2 point + Bls12381HashToG2 = 62, + // Cost of performing BLS12-381 pairing operation + Bls12381Pairing = 63, + // Cost of converting a BLS12-381 scalar element from U256 + Bls12381FrFromU256 = 64, + // Cost of converting a BLS12-381 scalar element to U256 + Bls12381FrToU256 = 65, + // Cost of performing BLS12-381 scalar element addition/subtraction + Bls12381FrAddSub = 66, + // Cost of performing BLS12-381 scalar element multiplication + Bls12381FrMul = 67, + // Cost of performing BLS12-381 scalar element exponentiation + Bls12381FrPow = 68, + // Cost of performing BLS12-381 scalar element inversion + Bls12381FrInv = 69 }; struct ContractCostParamEntry { diff --git a/xdr/curr/Stellar-contract-env-meta.x b/xdr/curr/Stellar-contract-env-meta.x index 330726de4..ed6b0b675 100644 --- a/xdr/curr/Stellar-contract-env-meta.x +++ b/xdr/curr/Stellar-contract-env-meta.x @@ -17,7 +17,10 @@ enum SCEnvMetaKind union SCEnvMetaEntry switch (SCEnvMetaKind kind) { case SC_ENV_META_KIND_INTERFACE_VERSION: - uint64 interfaceVersion; + struct { + uint32 protocol; + uint32 preRelease; + } interfaceVersion; }; } diff --git a/xdr/curr/Stellar-transaction.x b/xdr/curr/Stellar-transaction.x index d0ed328cb..7d3248102 100644 --- a/xdr/curr/Stellar-transaction.x +++ b/xdr/curr/Stellar-transaction.x @@ -541,12 +541,16 @@ union SorobanAuthorizedFunction switch (SorobanAuthorizedFunctionType type) { case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN: InvokeContractArgs contractFn; -// This variant of auth payload for creating new contract instances is no -// longer accepted after protocol 22. +// This variant of auth payload for creating new contract instances +// doesn't allow specifying the constructor arguments, creating contracts +// with constructors that take arguments is only possible by authorizing +// `SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN` +// (protocol 22+). case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: CreateContractArgs createContractHostFn; // This variant of auth payload for creating new contract instances -// is only accepted in and after protocol 22. +// is only accepted in and after protocol 22. It allows authorizing the +// contract constructor arguments. case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN: CreateContractArgsV2 createContractV2HostFn; }; diff --git a/xdr/next/Stellar-contract-config-setting.x b/xdr/next/Stellar-contract-config-setting.x index 4c6c6ee4b..bd96f9f45 100644 --- a/xdr/next/Stellar-contract-config-setting.x +++ b/xdr/next/Stellar-contract-config-setting.x @@ -200,7 +200,58 @@ enum ContractCostType { // point on a 256-bit elliptic curve Sec1DecodePointUncompressed = 43, // Cost of verifying an ECDSA Secp256r1 signature - VerifyEcdsaSecp256r1Sig = 44 + VerifyEcdsaSecp256r1Sig = 44, + + // Cost of encoding a BLS12-381 Fp (base field element) + Bls12381EncodeFp = 45, + // Cost of decoding a BLS12-381 Fp (base field element) + Bls12381DecodeFp = 46, + // Cost of checking a G1 point lies on the curve + Bls12381G1CheckPointOnCurve = 47, + // Cost of checking a G1 point belongs to the correct subgroup + Bls12381G1CheckPointInSubgroup = 48, + // Cost of checking a G2 point lies on the curve + Bls12381G2CheckPointOnCurve = 49, + // Cost of checking a G2 point belongs to the correct subgroup + Bls12381G2CheckPointInSubgroup = 50, + // Cost of converting a BLS12-381 G1 point from projective to affine coordinates + Bls12381G1ProjectiveToAffine = 51, + // Cost of converting a BLS12-381 G2 point from projective to affine coordinates + Bls12381G2ProjectiveToAffine = 52, + // Cost of performing BLS12-381 G1 point addition + Bls12381G1Add = 53, + // Cost of performing BLS12-381 G1 scalar multiplication + Bls12381G1Mul = 54, + // Cost of performing BLS12-381 G1 multi-scalar multiplication (MSM) + Bls12381G1Msm = 55, + // Cost of mapping a BLS12-381 Fp field element to a G1 point + Bls12381MapFpToG1 = 56, + // Cost of hashing to a BLS12-381 G1 point + Bls12381HashToG1 = 57, + // Cost of performing BLS12-381 G2 point addition + Bls12381G2Add = 58, + // Cost of performing BLS12-381 G2 scalar multiplication + Bls12381G2Mul = 59, + // Cost of performing BLS12-381 G2 multi-scalar multiplication (MSM) + Bls12381G2Msm = 60, + // Cost of mapping a BLS12-381 Fp2 field element to a G2 point + Bls12381MapFp2ToG2 = 61, + // Cost of hashing to a BLS12-381 G2 point + Bls12381HashToG2 = 62, + // Cost of performing BLS12-381 pairing operation + Bls12381Pairing = 63, + // Cost of converting a BLS12-381 scalar element from U256 + Bls12381FrFromU256 = 64, + // Cost of converting a BLS12-381 scalar element to U256 + Bls12381FrToU256 = 65, + // Cost of performing BLS12-381 scalar element addition/subtraction + Bls12381FrAddSub = 66, + // Cost of performing BLS12-381 scalar element multiplication + Bls12381FrMul = 67, + // Cost of performing BLS12-381 scalar element exponentiation + Bls12381FrPow = 68, + // Cost of performing BLS12-381 scalar element inversion + Bls12381FrInv = 69 }; struct ContractCostParamEntry { diff --git a/xdr/next/Stellar-contract-env-meta.x b/xdr/next/Stellar-contract-env-meta.x index 330726de4..ed6b0b675 100644 --- a/xdr/next/Stellar-contract-env-meta.x +++ b/xdr/next/Stellar-contract-env-meta.x @@ -17,7 +17,10 @@ enum SCEnvMetaKind union SCEnvMetaEntry switch (SCEnvMetaKind kind) { case SC_ENV_META_KIND_INTERFACE_VERSION: - uint64 interfaceVersion; + struct { + uint32 protocol; + uint32 preRelease; + } interfaceVersion; }; } diff --git a/xdr/next/Stellar-transaction.x b/xdr/next/Stellar-transaction.x index 3a548ab81..f285506f2 100644 --- a/xdr/next/Stellar-transaction.x +++ b/xdr/next/Stellar-transaction.x @@ -541,12 +541,16 @@ union SorobanAuthorizedFunction switch (SorobanAuthorizedFunctionType type) { case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN: InvokeContractArgs contractFn; -// This variant of auth payload for creating new contract instances is no -// longer accepted after protocol 22. +// This variant of auth payload for creating new contract instances +// doesn't allow specifying the constructor arguments, creating contracts +// with constructors that take arguments is only possible by authorizing +// `SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN` +// (protocol 22+). case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN: CreateContractArgs createContractHostFn; // This variant of auth payload for creating new contract instances -// is only accepted in and after protocol 22. +// is only accepted in and after protocol 22. It allows authorizing the +// contract constructor arguments. case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN: CreateContractArgsV2 createContractV2HostFn; };