diff --git a/Makefile b/Makefile index 3c666a89f5..35249d0e0d 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ XDRS = $(DOWNLOADABLE_XDRS) xdr/Stellar-exporter.x XDRGEN_COMMIT=e2cac557162d99b12ae73b846cf3d5bfe16636de -XDR_COMMIT=4ec28d95dd84b109253e22b151314478d6f00522 +XDR_COMMIT=172a47c08cfbeb245e58dea5f840d1347f6b59d9 .PHONY: xdr xdr-clean xdr-update diff --git a/gxdr/xdr_generated.go b/gxdr/xdr_generated.go index 2ccd3d1ff3..06e674bbf9 100644 --- a/gxdr/xdr_generated.go +++ b/gxdr/xdr_generated.go @@ -4016,10 +4016,14 @@ const ( type SCEnvMetaEntry struct { // The union discriminant Kind selects among the following arms: // SC_ENV_META_KIND_INTERFACE_VERSION: - // InterfaceVersion() *Uint64 + // InterfaceVersion() *XdrAnon_SCEnvMetaEntry_InterfaceVersion Kind SCEnvMetaKind _u interface{} } +type XdrAnon_SCEnvMetaEntry_InterfaceVersion struct { + Protocol Uint32 + PreRelease Uint32 +} type SCMetaV0 struct { Key string @@ -4705,6 +4709,52 @@ const ( Sec1DecodePointUncompressed ContractCostType = 43 // Cost of verifying an ECDSA Secp256r1 signature VerifyEcdsaSecp256r1Sig ContractCostType = 44 + // Cost of encoding a BLS12-381 Fp (base field element) + Bls12381EncodeFp ContractCostType = 45 + // Cost of decoding a BLS12-381 Fp (base field element) + Bls12381DecodeFp ContractCostType = 46 + // Cost of validating a G1 point lies on the curve and belongs to the correct subgroup + Bls12381G1Validate ContractCostType = 47 + // Cost of validating a G2 point lies on the curve and belongs to the correct subgroup + Bls12381G2Validate ContractCostType = 48 + // Cost of converting a BLS12-381 G1 point from projective to affine coordinates + Bls12381G1ProjectiveToAffine ContractCostType = 49 + // Cost of converting a BLS12-381 G2 point from projective to affine coordinates + Bls12381G2ProjectiveToAffine ContractCostType = 50 + // Cost of performing BLS12-381 G1 point addition + Bls12381G1Add ContractCostType = 51 + // Cost of performing BLS12-381 G1 scalar multiplication + Bls12381G1Mul ContractCostType = 52 + // Cost of performing BLS12-381 G1 multi-scalar multiplication (MSM) + Bls12381G1Msm ContractCostType = 53 + // Cost of mapping a BLS12-381 Fp field element to a G1 point + Bls12381MapFpToG1 ContractCostType = 54 + // Cost of hashing to a BLS12-381 G1 point + Bls12381HashToG1 ContractCostType = 55 + // Cost of performing BLS12-381 G2 point addition + Bls12381G2Add ContractCostType = 56 + // Cost of performing BLS12-381 G2 scalar multiplication + Bls12381G2Mul ContractCostType = 57 + // Cost of performing BLS12-381 G2 multi-scalar multiplication (MSM) + Bls12381G2Msm ContractCostType = 58 + // Cost of mapping a BLS12-381 Fp2 field element to a G2 point + Bls12381MapFp2ToG2 ContractCostType = 59 + // Cost of hashing to a BLS12-381 G2 point + Bls12381HashToG2 ContractCostType = 60 + // Cost of performing BLS12-381 pairing operation + Bls12381Pairing ContractCostType = 61 + // Cost of converting a BLS12-381 scalar element from U256 + Bls12381FrFromU256 ContractCostType = 62 + // Cost of converting a BLS12-381 scalar element to U256 + Bls12381FrToU256 ContractCostType = 63 + // Cost of performing BLS12-381 scalar element addition/subtraction + Bls12381FrAddSub ContractCostType = 64 + // Cost of performing BLS12-381 scalar element multiplication + Bls12381FrMul ContractCostType = 65 + // Cost of performing BLS12-381 scalar element exponentiation + Bls12381FrPow ContractCostType = 66 + // Cost of performing BLS12-381 scalar element inversion + Bls12381FrInv ContractCostType = 67 ) type ContractCostParamEntry struct { @@ -27128,6 +27178,25 @@ type XdrType_SCEnvMetaKind = *SCEnvMetaKind func XDR_SCEnvMetaKind(v *SCEnvMetaKind) *SCEnvMetaKind { return v } +type XdrType_XdrAnon_SCEnvMetaEntry_InterfaceVersion = *XdrAnon_SCEnvMetaEntry_InterfaceVersion + +func (v *XdrAnon_SCEnvMetaEntry_InterfaceVersion) XdrPointer() interface{} { return v } +func (XdrAnon_SCEnvMetaEntry_InterfaceVersion) XdrTypeName() string { + return "XdrAnon_SCEnvMetaEntry_InterfaceVersion" +} +func (v XdrAnon_SCEnvMetaEntry_InterfaceVersion) XdrValue() interface{} { return v } +func (v *XdrAnon_SCEnvMetaEntry_InterfaceVersion) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *XdrAnon_SCEnvMetaEntry_InterfaceVersion) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sprotocol", name), XDR_Uint32(&v.Protocol)) + x.Marshal(x.Sprintf("%spreRelease", name), XDR_Uint32(&v.PreRelease)) +} +func XDR_XdrAnon_SCEnvMetaEntry_InterfaceVersion(v *XdrAnon_SCEnvMetaEntry_InterfaceVersion) *XdrAnon_SCEnvMetaEntry_InterfaceVersion { + return v +} + var _XdrTags_SCEnvMetaEntry = map[int32]bool{ XdrToI32(SC_ENV_META_KIND_INTERFACE_VERSION): true, } @@ -27135,13 +27204,13 @@ var _XdrTags_SCEnvMetaEntry = map[int32]bool{ func (_ SCEnvMetaEntry) XdrValidTags() map[int32]bool { return _XdrTags_SCEnvMetaEntry } -func (u *SCEnvMetaEntry) InterfaceVersion() *Uint64 { +func (u *SCEnvMetaEntry) InterfaceVersion() *XdrAnon_SCEnvMetaEntry_InterfaceVersion { switch u.Kind { case SC_ENV_META_KIND_INTERFACE_VERSION: - if v, ok := u._u.(*Uint64); ok { + if v, ok := u._u.(*XdrAnon_SCEnvMetaEntry_InterfaceVersion); ok { return v } else { - var zero Uint64 + var zero XdrAnon_SCEnvMetaEntry_InterfaceVersion u._u = &zero return &zero } @@ -27166,7 +27235,7 @@ func (u *SCEnvMetaEntry) XdrUnionTagName() string { func (u *SCEnvMetaEntry) XdrUnionBody() XdrType { switch u.Kind { case SC_ENV_META_KIND_INTERFACE_VERSION: - return XDR_Uint64(u.InterfaceVersion()) + return XDR_XdrAnon_SCEnvMetaEntry_InterfaceVersion(u.InterfaceVersion()) } return nil } @@ -27191,7 +27260,7 @@ func (u *SCEnvMetaEntry) XdrRecurse(x XDR, name string) { XDR_SCEnvMetaKind(&u.Kind).XdrMarshal(x, x.Sprintf("%skind", name)) switch u.Kind { case SC_ENV_META_KIND_INTERFACE_VERSION: - x.Marshal(x.Sprintf("%sinterfaceVersion", name), XDR_Uint64(u.InterfaceVersion())) + x.Marshal(x.Sprintf("%sinterfaceVersion", name), XDR_XdrAnon_SCEnvMetaEntry_InterfaceVersion(u.InterfaceVersion())) return } XdrPanic("invalid Kind (%v) in SCEnvMetaEntry", u.Kind) @@ -30666,6 +30735,29 @@ var _XdrNames_ContractCostType = map[int32]string{ int32(InstantiateWasmDataSegmentBytes): "InstantiateWasmDataSegmentBytes", int32(Sec1DecodePointUncompressed): "Sec1DecodePointUncompressed", int32(VerifyEcdsaSecp256r1Sig): "VerifyEcdsaSecp256r1Sig", + int32(Bls12381EncodeFp): "Bls12381EncodeFp", + int32(Bls12381DecodeFp): "Bls12381DecodeFp", + int32(Bls12381G1Validate): "Bls12381G1Validate", + int32(Bls12381G2Validate): "Bls12381G2Validate", + int32(Bls12381G1ProjectiveToAffine): "Bls12381G1ProjectiveToAffine", + int32(Bls12381G2ProjectiveToAffine): "Bls12381G2ProjectiveToAffine", + int32(Bls12381G1Add): "Bls12381G1Add", + int32(Bls12381G1Mul): "Bls12381G1Mul", + int32(Bls12381G1Msm): "Bls12381G1Msm", + int32(Bls12381MapFpToG1): "Bls12381MapFpToG1", + int32(Bls12381HashToG1): "Bls12381HashToG1", + int32(Bls12381G2Add): "Bls12381G2Add", + int32(Bls12381G2Mul): "Bls12381G2Mul", + int32(Bls12381G2Msm): "Bls12381G2Msm", + int32(Bls12381MapFp2ToG2): "Bls12381MapFp2ToG2", + int32(Bls12381HashToG2): "Bls12381HashToG2", + int32(Bls12381Pairing): "Bls12381Pairing", + int32(Bls12381FrFromU256): "Bls12381FrFromU256", + int32(Bls12381FrToU256): "Bls12381FrToU256", + int32(Bls12381FrAddSub): "Bls12381FrAddSub", + int32(Bls12381FrMul): "Bls12381FrMul", + int32(Bls12381FrPow): "Bls12381FrPow", + int32(Bls12381FrInv): "Bls12381FrInv", } var _XdrValues_ContractCostType = map[string]int32{ "WasmInsnExec": int32(WasmInsnExec), @@ -30713,6 +30805,29 @@ var _XdrValues_ContractCostType = map[string]int32{ "InstantiateWasmDataSegmentBytes": int32(InstantiateWasmDataSegmentBytes), "Sec1DecodePointUncompressed": int32(Sec1DecodePointUncompressed), "VerifyEcdsaSecp256r1Sig": int32(VerifyEcdsaSecp256r1Sig), + "Bls12381EncodeFp": int32(Bls12381EncodeFp), + "Bls12381DecodeFp": int32(Bls12381DecodeFp), + "Bls12381G1Validate": int32(Bls12381G1Validate), + "Bls12381G2Validate": int32(Bls12381G2Validate), + "Bls12381G1ProjectiveToAffine": int32(Bls12381G1ProjectiveToAffine), + "Bls12381G2ProjectiveToAffine": int32(Bls12381G2ProjectiveToAffine), + "Bls12381G1Add": int32(Bls12381G1Add), + "Bls12381G1Mul": int32(Bls12381G1Mul), + "Bls12381G1Msm": int32(Bls12381G1Msm), + "Bls12381MapFpToG1": int32(Bls12381MapFpToG1), + "Bls12381HashToG1": int32(Bls12381HashToG1), + "Bls12381G2Add": int32(Bls12381G2Add), + "Bls12381G2Mul": int32(Bls12381G2Mul), + "Bls12381G2Msm": int32(Bls12381G2Msm), + "Bls12381MapFp2ToG2": int32(Bls12381MapFp2ToG2), + "Bls12381HashToG2": int32(Bls12381HashToG2), + "Bls12381Pairing": int32(Bls12381Pairing), + "Bls12381FrFromU256": int32(Bls12381FrFromU256), + "Bls12381FrToU256": int32(Bls12381FrToU256), + "Bls12381FrAddSub": int32(Bls12381FrAddSub), + "Bls12381FrMul": int32(Bls12381FrMul), + "Bls12381FrPow": int32(Bls12381FrPow), + "Bls12381FrInv": int32(Bls12381FrInv), } func (ContractCostType) XdrEnumNames() map[int32]string { @@ -30797,6 +30912,29 @@ var _XdrComments_ContractCostType = map[int32]string{ int32(InstantiateWasmDataSegmentBytes): "Cost of instantiating a known number of data segment bytes.", int32(Sec1DecodePointUncompressed): "Cost of decoding a bytes array representing an uncompressed SEC-1 encoded point on a 256-bit elliptic curve", int32(VerifyEcdsaSecp256r1Sig): "Cost of verifying an ECDSA Secp256r1 signature", + int32(Bls12381EncodeFp): "Cost of encoding a BLS12-381 Fp (base field element)", + int32(Bls12381DecodeFp): "Cost of decoding a BLS12-381 Fp (base field element)", + int32(Bls12381G1Validate): "Cost of validating a G1 point lies on the curve and belongs to the correct subgroup", + int32(Bls12381G2Validate): "Cost of validating a G2 point lies on the curve and belongs to the correct subgroup", + int32(Bls12381G1ProjectiveToAffine): "Cost of converting a BLS12-381 G1 point from projective to affine coordinates", + int32(Bls12381G2ProjectiveToAffine): "Cost of converting a BLS12-381 G2 point from projective to affine coordinates", + int32(Bls12381G1Add): "Cost of performing BLS12-381 G1 point addition", + int32(Bls12381G1Mul): "Cost of performing BLS12-381 G1 scalar multiplication", + int32(Bls12381G1Msm): "Cost of performing BLS12-381 G1 multi-scalar multiplication (MSM)", + int32(Bls12381MapFpToG1): "Cost of mapping a BLS12-381 Fp field element to a G1 point", + int32(Bls12381HashToG1): "Cost of hashing to a BLS12-381 G1 point", + int32(Bls12381G2Add): "Cost of performing BLS12-381 G2 point addition", + int32(Bls12381G2Mul): "Cost of performing BLS12-381 G2 scalar multiplication", + int32(Bls12381G2Msm): "Cost of performing BLS12-381 G2 multi-scalar multiplication (MSM)", + int32(Bls12381MapFp2ToG2): "Cost of mapping a BLS12-381 Fp2 field element to a G2 point", + int32(Bls12381HashToG2): "Cost of hashing to a BLS12-381 G2 point", + int32(Bls12381Pairing): "Cost of performing BLS12-381 pairing operation", + int32(Bls12381FrFromU256): "Cost of converting a BLS12-381 scalar element from U256", + int32(Bls12381FrToU256): "Cost of converting a BLS12-381 scalar element to U256", + int32(Bls12381FrAddSub): "Cost of performing BLS12-381 scalar element addition/subtraction", + int32(Bls12381FrMul): "Cost of performing BLS12-381 scalar element multiplication", + int32(Bls12381FrPow): "Cost of performing BLS12-381 scalar element exponentiation", + int32(Bls12381FrInv): "Cost of performing BLS12-381 scalar element inversion", } func (e ContractCostType) XdrEnumComments() map[int32]string { diff --git a/xdr/Stellar-contract-config-setting.x b/xdr/Stellar-contract-config-setting.x index 52cc0224df..b8ba009a53 100644 --- a/xdr/Stellar-contract-config-setting.x +++ b/xdr/Stellar-contract-config-setting.x @@ -188,7 +188,54 @@ 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 validating a G1 point lies on the curve and belongs to the correct subgroup + Bls12381G1Validate = 47, + // Cost of validating a G2 point lies on the curve and belongs to the correct subgroup + Bls12381G2Validate = 48, + // Cost of converting a BLS12-381 G1 point from projective to affine coordinates + Bls12381G1ProjectiveToAffine = 49, + // Cost of converting a BLS12-381 G2 point from projective to affine coordinates + Bls12381G2ProjectiveToAffine = 50, + // Cost of performing BLS12-381 G1 point addition + Bls12381G1Add = 51, + // Cost of performing BLS12-381 G1 scalar multiplication + Bls12381G1Mul = 52, + // Cost of performing BLS12-381 G1 multi-scalar multiplication (MSM) + Bls12381G1Msm = 53, + // Cost of mapping a BLS12-381 Fp field element to a G1 point + Bls12381MapFpToG1 = 54, + // Cost of hashing to a BLS12-381 G1 point + Bls12381HashToG1 = 55, + // Cost of performing BLS12-381 G2 point addition + Bls12381G2Add = 56, + // Cost of performing BLS12-381 G2 scalar multiplication + Bls12381G2Mul = 57, + // Cost of performing BLS12-381 G2 multi-scalar multiplication (MSM) + Bls12381G2Msm = 58, + // Cost of mapping a BLS12-381 Fp2 field element to a G2 point + Bls12381MapFp2ToG2 = 59, + // Cost of hashing to a BLS12-381 G2 point + Bls12381HashToG2 = 60, + // Cost of performing BLS12-381 pairing operation + Bls12381Pairing = 61, + // Cost of converting a BLS12-381 scalar element from U256 + Bls12381FrFromU256 = 62, + // Cost of converting a BLS12-381 scalar element to U256 + Bls12381FrToU256 = 63, + // Cost of performing BLS12-381 scalar element addition/subtraction + Bls12381FrAddSub = 64, + // Cost of performing BLS12-381 scalar element multiplication + Bls12381FrMul = 65, + // Cost of performing BLS12-381 scalar element exponentiation + Bls12381FrPow = 66, + // Cost of performing BLS12-381 scalar element inversion + Bls12381FrInv = 67 }; struct ContractCostParamEntry { diff --git a/xdr/Stellar-contract-env-meta.x b/xdr/Stellar-contract-env-meta.x index 330726de41..ed6b0b675b 100644 --- a/xdr/Stellar-contract-env-meta.x +++ b/xdr/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/Stellar-transaction.x b/xdr/Stellar-transaction.x index d0ed328cbd..7d3248102b 100644 --- a/xdr/Stellar-transaction.x +++ b/xdr/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/xdr_commit_generated.txt b/xdr/xdr_commit_generated.txt index 20860efdcb..94a74b60c3 100644 --- a/xdr/xdr_commit_generated.txt +++ b/xdr/xdr_commit_generated.txt @@ -1 +1 @@ -4ec28d95dd84b109253e22b151314478d6f00522 \ No newline at end of file +172a47c08cfbeb245e58dea5f840d1347f6b59d9 \ No newline at end of file diff --git a/xdr/xdr_generated.go b/xdr/xdr_generated.go index 0892e9f404..adf7ed9faa 100644 --- a/xdr/xdr_generated.go +++ b/xdr/xdr_generated.go @@ -33,8 +33,8 @@ import ( // XdrFilesSHA256 is the SHA256 hashes of source files. var XdrFilesSHA256 = map[string]string{ "xdr/Stellar-SCP.x": "8f32b04d008f8bc33b8843d075e69837231a673691ee41d8b821ca229a6e802a", - "xdr/Stellar-contract-config-setting.x": "393369678663cb0f9471a0b69e2a9cfa3ac93c4415fa40cec166e9a231ecbe0d", - "xdr/Stellar-contract-env-meta.x": "928a30de814ee589bc1d2aadd8dd81c39f71b7e6f430f56974505ccb1f49654b", + "xdr/Stellar-contract-config-setting.x": "73c32b6f05b43e1c22318ace568d607a633687d1adbb35cb3d022164cf38dab3", + "xdr/Stellar-contract-env-meta.x": "75a271414d852096fea3283c63b7f2a702f2905f78fc28eb60ec7d7bd366a780", "xdr/Stellar-contract-meta.x": "f01532c11ca044e19d9f9f16fe373e9af64835da473be556b9a807ee3319ae0d", "xdr/Stellar-contract-spec.x": "c7ffa21d2e91afb8e666b33524d307955426ff553a486d670c29217ed9888d49", "xdr/Stellar-contract.x": "7f665e4103e146a88fcdabce879aaaacd3bf9283feb194cc47ff986264c1e315", @@ -43,7 +43,7 @@ var XdrFilesSHA256 = map[string]string{ "xdr/Stellar-ledger-entries.x": "03e8be938bace784410b0e837ed6496ff66dc0d1e70fc6e4f0d006566a344879", "xdr/Stellar-ledger.x": "c2ac5bde5da28d4d02e2ea455f3bc5d5133adf271d374010cebe4e314c8504e8", "xdr/Stellar-overlay.x": "8c73b7c3ad974e7fc4aa4fdf34f7ad50053406254efbd7406c96657cf41691d3", - "xdr/Stellar-transaction.x": "a938e583ab5d25237c51f355a47446215575b720150db89a1cecf13773249df1", + "xdr/Stellar-transaction.x": "fdd854ea6ce450500c331a6613d714d9b2f00d2adc86210a8f709e8a9ef4c641", "xdr/Stellar-types.x": "253f515fc5e06bc938105e92a4c7f562251d4ebc178d39d6e6751e6b85fe1064", } @@ -29939,12 +29939,16 @@ var _ xdrType = (*SorobanAuthorizedFunctionType)(nil) // { // 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; // }; @@ -51603,16 +51607,93 @@ func (s ScEnvMetaKind) xdrType() {} var _ xdrType = (*ScEnvMetaKind)(nil) +// ScEnvMetaEntryInterfaceVersion is an XDR NestedStruct defines as: +// +// struct { +// uint32 protocol; +// uint32 preRelease; +// } +type ScEnvMetaEntryInterfaceVersion struct { + Protocol Uint32 + PreRelease Uint32 +} + +// EncodeTo encodes this value using the Encoder. +func (s *ScEnvMetaEntryInterfaceVersion) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.Protocol.EncodeTo(e); err != nil { + return err + } + if err = s.PreRelease.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*ScEnvMetaEntryInterfaceVersion)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *ScEnvMetaEntryInterfaceVersion) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding ScEnvMetaEntryInterfaceVersion: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.Protocol.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.PreRelease.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s ScEnvMetaEntryInterfaceVersion) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *ScEnvMetaEntryInterfaceVersion) UnmarshalBinary(inp []byte) error { + r := bytes.NewReader(inp) + o := xdr.DefaultDecodeOptions + o.MaxInputLen = len(inp) + d := xdr.NewDecoderWithOptions(r, o) + _, err := s.DecodeFrom(d, o.MaxDepth) + return err +} + +var ( + _ encoding.BinaryMarshaler = (*ScEnvMetaEntryInterfaceVersion)(nil) + _ encoding.BinaryUnmarshaler = (*ScEnvMetaEntryInterfaceVersion)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s ScEnvMetaEntryInterfaceVersion) xdrType() {} + +var _ xdrType = (*ScEnvMetaEntryInterfaceVersion)(nil) + // ScEnvMetaEntry is an XDR Union defines as: // // union SCEnvMetaEntry switch (SCEnvMetaKind kind) // { // case SC_ENV_META_KIND_INTERFACE_VERSION: -// uint64 interfaceVersion; +// struct { +// uint32 protocol; +// uint32 preRelease; +// } interfaceVersion; // }; type ScEnvMetaEntry struct { Kind ScEnvMetaKind - InterfaceVersion *Uint64 + InterfaceVersion *ScEnvMetaEntryInterfaceVersion } // SwitchFieldName returns the field name in which this union's @@ -51636,9 +51717,9 @@ func NewScEnvMetaEntry(kind ScEnvMetaKind, value interface{}) (result ScEnvMetaE result.Kind = kind switch ScEnvMetaKind(kind) { case ScEnvMetaKindScEnvMetaKindInterfaceVersion: - tv, ok := value.(Uint64) + tv, ok := value.(ScEnvMetaEntryInterfaceVersion) if !ok { - err = errors.New("invalid value, must be Uint64") + err = errors.New("invalid value, must be ScEnvMetaEntryInterfaceVersion") return } result.InterfaceVersion = &tv @@ -51648,7 +51729,7 @@ func NewScEnvMetaEntry(kind ScEnvMetaKind, value interface{}) (result ScEnvMetaE // MustInterfaceVersion retrieves the InterfaceVersion value from the union, // panicing if the value is not set. -func (u ScEnvMetaEntry) MustInterfaceVersion() Uint64 { +func (u ScEnvMetaEntry) MustInterfaceVersion() ScEnvMetaEntryInterfaceVersion { val, ok := u.GetInterfaceVersion() if !ok { @@ -51660,7 +51741,7 @@ func (u ScEnvMetaEntry) MustInterfaceVersion() Uint64 { // GetInterfaceVersion retrieves the InterfaceVersion value from the union, // returning ok if the union's switch indicated the value is valid. -func (u ScEnvMetaEntry) GetInterfaceVersion() (result Uint64, ok bool) { +func (u ScEnvMetaEntry) GetInterfaceVersion() (result ScEnvMetaEntryInterfaceVersion, ok bool) { armName, _ := u.ArmForSwitch(int32(u.Kind)) if armName == "InterfaceVersion" { @@ -51704,11 +51785,11 @@ func (u *ScEnvMetaEntry) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) } switch ScEnvMetaKind(u.Kind) { case ScEnvMetaKindScEnvMetaKindInterfaceVersion: - u.InterfaceVersion = new(Uint64) + u.InterfaceVersion = new(ScEnvMetaEntryInterfaceVersion) nTmp, err = (*u.InterfaceVersion).DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding Uint64: %w", err) + return n, fmt.Errorf("decoding ScEnvMetaEntryInterfaceVersion: %w", err) } return n, nil } @@ -60011,7 +60092,54 @@ var _ xdrType = (*ConfigSettingContractBandwidthV0)(nil) // // 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 validating a G1 point lies on the curve and belongs to the correct subgroup +// Bls12381G1Validate = 47, +// // Cost of validating a G2 point lies on the curve and belongs to the correct subgroup +// Bls12381G2Validate = 48, +// // Cost of converting a BLS12-381 G1 point from projective to affine coordinates +// Bls12381G1ProjectiveToAffine = 49, +// // Cost of converting a BLS12-381 G2 point from projective to affine coordinates +// Bls12381G2ProjectiveToAffine = 50, +// // Cost of performing BLS12-381 G1 point addition +// Bls12381G1Add = 51, +// // Cost of performing BLS12-381 G1 scalar multiplication +// Bls12381G1Mul = 52, +// // Cost of performing BLS12-381 G1 multi-scalar multiplication (MSM) +// Bls12381G1Msm = 53, +// // Cost of mapping a BLS12-381 Fp field element to a G1 point +// Bls12381MapFpToG1 = 54, +// // Cost of hashing to a BLS12-381 G1 point +// Bls12381HashToG1 = 55, +// // Cost of performing BLS12-381 G2 point addition +// Bls12381G2Add = 56, +// // Cost of performing BLS12-381 G2 scalar multiplication +// Bls12381G2Mul = 57, +// // Cost of performing BLS12-381 G2 multi-scalar multiplication (MSM) +// Bls12381G2Msm = 58, +// // Cost of mapping a BLS12-381 Fp2 field element to a G2 point +// Bls12381MapFp2ToG2 = 59, +// // Cost of hashing to a BLS12-381 G2 point +// Bls12381HashToG2 = 60, +// // Cost of performing BLS12-381 pairing operation +// Bls12381Pairing = 61, +// // Cost of converting a BLS12-381 scalar element from U256 +// Bls12381FrFromU256 = 62, +// // Cost of converting a BLS12-381 scalar element to U256 +// Bls12381FrToU256 = 63, +// // Cost of performing BLS12-381 scalar element addition/subtraction +// Bls12381FrAddSub = 64, +// // Cost of performing BLS12-381 scalar element multiplication +// Bls12381FrMul = 65, +// // Cost of performing BLS12-381 scalar element exponentiation +// Bls12381FrPow = 66, +// // Cost of performing BLS12-381 scalar element inversion +// Bls12381FrInv = 67 // }; type ContractCostType int32 @@ -60061,6 +60189,29 @@ const ( ContractCostTypeInstantiateWasmDataSegmentBytes ContractCostType = 42 ContractCostTypeSec1DecodePointUncompressed ContractCostType = 43 ContractCostTypeVerifyEcdsaSecp256r1Sig ContractCostType = 44 + ContractCostTypeBls12381EncodeFp ContractCostType = 45 + ContractCostTypeBls12381DecodeFp ContractCostType = 46 + ContractCostTypeBls12381G1Validate ContractCostType = 47 + ContractCostTypeBls12381G2Validate ContractCostType = 48 + ContractCostTypeBls12381G1ProjectiveToAffine ContractCostType = 49 + ContractCostTypeBls12381G2ProjectiveToAffine ContractCostType = 50 + ContractCostTypeBls12381G1Add ContractCostType = 51 + ContractCostTypeBls12381G1Mul ContractCostType = 52 + ContractCostTypeBls12381G1Msm ContractCostType = 53 + ContractCostTypeBls12381MapFpToG1 ContractCostType = 54 + ContractCostTypeBls12381HashToG1 ContractCostType = 55 + ContractCostTypeBls12381G2Add ContractCostType = 56 + ContractCostTypeBls12381G2Mul ContractCostType = 57 + ContractCostTypeBls12381G2Msm ContractCostType = 58 + ContractCostTypeBls12381MapFp2ToG2 ContractCostType = 59 + ContractCostTypeBls12381HashToG2 ContractCostType = 60 + ContractCostTypeBls12381Pairing ContractCostType = 61 + ContractCostTypeBls12381FrFromU256 ContractCostType = 62 + ContractCostTypeBls12381FrToU256 ContractCostType = 63 + ContractCostTypeBls12381FrAddSub ContractCostType = 64 + ContractCostTypeBls12381FrMul ContractCostType = 65 + ContractCostTypeBls12381FrPow ContractCostType = 66 + ContractCostTypeBls12381FrInv ContractCostType = 67 ) var contractCostTypeMap = map[int32]string{ @@ -60109,6 +60260,29 @@ var contractCostTypeMap = map[int32]string{ 42: "ContractCostTypeInstantiateWasmDataSegmentBytes", 43: "ContractCostTypeSec1DecodePointUncompressed", 44: "ContractCostTypeVerifyEcdsaSecp256r1Sig", + 45: "ContractCostTypeBls12381EncodeFp", + 46: "ContractCostTypeBls12381DecodeFp", + 47: "ContractCostTypeBls12381G1Validate", + 48: "ContractCostTypeBls12381G2Validate", + 49: "ContractCostTypeBls12381G1ProjectiveToAffine", + 50: "ContractCostTypeBls12381G2ProjectiveToAffine", + 51: "ContractCostTypeBls12381G1Add", + 52: "ContractCostTypeBls12381G1Mul", + 53: "ContractCostTypeBls12381G1Msm", + 54: "ContractCostTypeBls12381MapFpToG1", + 55: "ContractCostTypeBls12381HashToG1", + 56: "ContractCostTypeBls12381G2Add", + 57: "ContractCostTypeBls12381G2Mul", + 58: "ContractCostTypeBls12381G2Msm", + 59: "ContractCostTypeBls12381MapFp2ToG2", + 60: "ContractCostTypeBls12381HashToG2", + 61: "ContractCostTypeBls12381Pairing", + 62: "ContractCostTypeBls12381FrFromU256", + 63: "ContractCostTypeBls12381FrToU256", + 64: "ContractCostTypeBls12381FrAddSub", + 65: "ContractCostTypeBls12381FrMul", + 66: "ContractCostTypeBls12381FrPow", + 67: "ContractCostTypeBls12381FrInv", } // ValidEnum validates a proposed value for this enum. Implements