diff --git a/.github/workflows/horizon.yml b/.github/workflows/horizon.yml index 74c3f47725..c1618d21c8 100644 --- a/.github/workflows/horizon.yml +++ b/.github/workflows/horizon.yml @@ -13,7 +13,7 @@ jobs: os: [ubuntu-20.04, ubuntu-22.04] go: ["1.21", "1.22"] pg: [12, 16] - protocol-version: [20] + protocol-version: [20, 21] runs-on: ${{ matrix.os }} services: postgres: @@ -32,11 +32,13 @@ jobs: env: HORIZON_INTEGRATION_TESTS_ENABLED: true HORIZON_INTEGRATION_TESTS_CORE_MAX_SUPPORTED_PROTOCOL: ${{ matrix.protocol-version }} - PROTOCOL_20_CORE_DEBIAN_PKG_VERSION: 20.2.0-1716.rc3.34d82fc00.focal - PROTOCOL_20_CORE_DOCKER_IMG: stellar/unsafe-stellar-core:20.2.0-1716.rc3.34d82fc00.focal + PROTOCOL_21_CORE_DEBIAN_PKG_VERSION: 20.4.1-1807.b152dc51d.focal + PROTOCOL_21_CORE_DOCKER_IMG: stellar/unsafe-stellar-core:20.4.1-1807.b152dc51d.focal + PROTOCOL_21_SOROBAN_RPC_DOCKER_IMG: stellar/soroban-rpc:21.0.0-rc1-68 + PROTOCOL_20_CORE_DEBIAN_PKG_VERSION: 20.4.1-1807.b152dc51d.focal + PROTOCOL_20_CORE_DOCKER_IMG: stellar/unsafe-stellar-core:20.4.1-1807.b152dc51d.focal + # TODO: bump soroban-rpc to the p21 version once it supports it PROTOCOL_20_SOROBAN_RPC_DOCKER_IMG: stellar/soroban-rpc:20.3.0-rc1-52 - PROTOCOL_19_CORE_DEBIAN_PKG_VERSION: 19.14.0-1500.5664eff4e.focal - PROTOCOL_19_CORE_DOCKER_IMG: stellar/stellar-core:19.14.0-1500.5664eff4e.focal PGHOST: localhost PGPORT: 5432 PGUSER: postgres diff --git a/Makefile b/Makefile index 291cc282fc..8ac1abb337 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ XDRS = $(DOWNLOADABLE_XDRS) xdr/Stellar-lighthorizon.x \ XDRGEN_COMMIT=e2cac557162d99b12ae73b846cf3d5bfe16636de -XDR_COMMIT=b96148cd4acc372cc9af17b909ffe4b12c43ecb6 +XDR_COMMIT=59062438237d5f77fd6feb060b76288e88b7e222 .PHONY: xdr xdr-clean xdr-update diff --git a/gxdr/xdr_generated.go b/gxdr/xdr_generated.go index d4cd83cdf0..e7c8f3ed58 100644 --- a/gxdr/xdr_generated.go +++ b/gxdr/xdr_generated.go @@ -639,11 +639,38 @@ type ContractDataEntry struct { Val SCVal } +type ContractCodeCostInputs struct { + Ext ExtensionPoint + NInstructions Uint32 + NFunctions Uint32 + NGlobals Uint32 + NTableEntries Uint32 + NTypes Uint32 + NDataSegments Uint32 + NElemSegments Uint32 + NImports Uint32 + NExports Uint32 + NDataSegmentBytes Uint32 +} + type ContractCodeEntry struct { - Ext ExtensionPoint + Ext XdrAnon_ContractCodeEntry_Ext Hash Hash Code []byte } +type XdrAnon_ContractCodeEntry_Ext struct { + // The union discriminant V selects among the following arms: + // 0: + // void + // 1: + // V1() *XdrAnon_ContractCodeEntry_Ext_V1 + V int32 + _u interface{} +} +type XdrAnon_ContractCodeEntry_Ext_V1 struct { + Ext ExtensionPoint + CostInputs ContractCodeCostInputs +} type TTLEntry struct { // Hash of the LedgerKey that is associated with this TTLEntry @@ -1197,8 +1224,39 @@ type DiagnosticEvent struct { Event ContractEvent } -type SorobanTransactionMeta struct { +type SorobanTransactionMetaExtV1 struct { Ext ExtensionPoint + // Total amount (in stroops) that has been charged for non-refundable + // Soroban resources. + // Non-refundable resources are charged based on the usage declared in + // the transaction envelope (such as `instructions`, `readBytes` etc.) and + // is charged regardless of the success of the transaction. + TotalNonRefundableResourceFeeCharged Int64 + // Total amount (in stroops) that has been charged for refundable + // Soroban resource fees. + // Currently this comprises the rent fee (`rentFeeCharged`) and the + // fee for the events and return value. + // Refundable resources are charged based on the actual resources usage. + // Since currently refundable resources are only used for the successful + // transactions, this will be `0` for failed transactions. + TotalRefundableResourceFeeCharged Int64 + // Amount (in stroops) that has been charged for rent. + // This is a part of `totalNonRefundableResourceFeeCharged`. + RentFeeCharged Int64 +} + +type SorobanTransactionMetaExt struct { + // The union discriminant V selects among the following arms: + // 0: + // void + // 1: + // V1() *SorobanTransactionMetaExtV1 + V int32 + _u interface{} +} + +type SorobanTransactionMeta struct { + Ext SorobanTransactionMetaExt // custom events populated by the Events []ContractEvent // contracts themselves. @@ -1273,10 +1331,23 @@ type LedgerCloseMetaV0 struct { ScpInfo []SCPHistoryEntry } +type LedgerCloseMetaExtV1 struct { + Ext ExtensionPoint + SorobanFeeWrite1KB Int64 +} + +type LedgerCloseMetaExt struct { + // The union discriminant V selects among the following arms: + // 0: + // void + // 1: + // V1() *LedgerCloseMetaExtV1 + V int32 + _u interface{} +} + type LedgerCloseMetaV1 struct { - // We forgot to add an ExtensionPoint in v0 but at least - // we can add one now in v1. - Ext ExtensionPoint + Ext LedgerCloseMetaExt LedgerHeader LedgerHeaderHistoryEntry TxSet GeneralizedTransactionSet // NB: transactions are sorted in apply order here @@ -4305,8 +4376,9 @@ const ( InvokeVmFunction ContractCostType = 13 // Cost of computing a keccak256 hash from bytes. ComputeKeccak256Hash ContractCostType = 14 - // Cost of computing an ECDSA secp256k1 signature from bytes. - ComputeEcdsaSecp256k1Sig ContractCostType = 15 + // Cost of decoding an ECDSA signature computed from a 256-bit prime modulus + // curve (e.g. secp256k1 and secp256r1) + DecodeEcdsaCurve256Sig ContractCostType = 15 // Cost of recovering an ECDSA secp256k1 key from a signature. RecoverEcdsaSecp256k1Key ContractCostType = 16 // Cost of int256 addition (`+`) and subtraction (`-`) operations @@ -4321,6 +4393,51 @@ const ( Int256Shift ContractCostType = 21 // Cost of drawing random bytes using a ChaCha20 PRNG ChaCha20DrawBytes ContractCostType = 22 + // Cost of parsing wasm bytes that only encode instructions. + ParseWasmInstructions ContractCostType = 23 + // Cost of parsing a known number of wasm functions. + ParseWasmFunctions ContractCostType = 24 + // Cost of parsing a known number of wasm globals. + ParseWasmGlobals ContractCostType = 25 + // Cost of parsing a known number of wasm table entries. + ParseWasmTableEntries ContractCostType = 26 + // Cost of parsing a known number of wasm types. + ParseWasmTypes ContractCostType = 27 + // Cost of parsing a known number of wasm data segments. + ParseWasmDataSegments ContractCostType = 28 + // Cost of parsing a known number of wasm element segments. + ParseWasmElemSegments ContractCostType = 29 + // Cost of parsing a known number of wasm imports. + ParseWasmImports ContractCostType = 30 + // Cost of parsing a known number of wasm exports. + ParseWasmExports ContractCostType = 31 + // Cost of parsing a known number of data segment bytes. + ParseWasmDataSegmentBytes ContractCostType = 32 + // Cost of instantiating wasm bytes that only encode instructions. + InstantiateWasmInstructions ContractCostType = 33 + // Cost of instantiating a known number of wasm functions. + InstantiateWasmFunctions ContractCostType = 34 + // Cost of instantiating a known number of wasm globals. + InstantiateWasmGlobals ContractCostType = 35 + // Cost of instantiating a known number of wasm table entries. + InstantiateWasmTableEntries ContractCostType = 36 + // Cost of instantiating a known number of wasm types. + InstantiateWasmTypes ContractCostType = 37 + // Cost of instantiating a known number of wasm data segments. + InstantiateWasmDataSegments ContractCostType = 38 + // Cost of instantiating a known number of wasm element segments. + InstantiateWasmElemSegments ContractCostType = 39 + // Cost of instantiating a known number of wasm imports. + InstantiateWasmImports ContractCostType = 40 + // Cost of instantiating a known number of wasm exports. + InstantiateWasmExports ContractCostType = 41 + // Cost of instantiating a known number of data segment bytes. + InstantiateWasmDataSegmentBytes ContractCostType = 42 + // Cost of decoding a bytes array representing an uncompressed SEC-1 encoded + // point on a 256-bit elliptic curve + Sec1DecodePointUncompressed ContractCostType = 43 + // Cost of verifying an ECDSA Secp256r1 signature + VerifyEcdsaSecp256r1Sig ContractCostType = 44 ) type ContractCostParamEntry struct { @@ -7966,6 +8083,128 @@ func (v *ContractDataEntry) XdrRecurse(x XDR, name string) { } func XDR_ContractDataEntry(v *ContractDataEntry) *ContractDataEntry { return v } +type XdrType_ContractCodeCostInputs = *ContractCodeCostInputs + +func (v *ContractCodeCostInputs) XdrPointer() interface{} { return v } +func (ContractCodeCostInputs) XdrTypeName() string { return "ContractCodeCostInputs" } +func (v ContractCodeCostInputs) XdrValue() interface{} { return v } +func (v *ContractCodeCostInputs) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *ContractCodeCostInputs) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sext", name), XDR_ExtensionPoint(&v.Ext)) + x.Marshal(x.Sprintf("%snInstructions", name), XDR_Uint32(&v.NInstructions)) + x.Marshal(x.Sprintf("%snFunctions", name), XDR_Uint32(&v.NFunctions)) + x.Marshal(x.Sprintf("%snGlobals", name), XDR_Uint32(&v.NGlobals)) + x.Marshal(x.Sprintf("%snTableEntries", name), XDR_Uint32(&v.NTableEntries)) + x.Marshal(x.Sprintf("%snTypes", name), XDR_Uint32(&v.NTypes)) + x.Marshal(x.Sprintf("%snDataSegments", name), XDR_Uint32(&v.NDataSegments)) + x.Marshal(x.Sprintf("%snElemSegments", name), XDR_Uint32(&v.NElemSegments)) + x.Marshal(x.Sprintf("%snImports", name), XDR_Uint32(&v.NImports)) + x.Marshal(x.Sprintf("%snExports", name), XDR_Uint32(&v.NExports)) + x.Marshal(x.Sprintf("%snDataSegmentBytes", name), XDR_Uint32(&v.NDataSegmentBytes)) +} +func XDR_ContractCodeCostInputs(v *ContractCodeCostInputs) *ContractCodeCostInputs { return v } + +type XdrType_XdrAnon_ContractCodeEntry_Ext_V1 = *XdrAnon_ContractCodeEntry_Ext_V1 + +func (v *XdrAnon_ContractCodeEntry_Ext_V1) XdrPointer() interface{} { return v } +func (XdrAnon_ContractCodeEntry_Ext_V1) XdrTypeName() string { + return "XdrAnon_ContractCodeEntry_Ext_V1" +} +func (v XdrAnon_ContractCodeEntry_Ext_V1) XdrValue() interface{} { return v } +func (v *XdrAnon_ContractCodeEntry_Ext_V1) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *XdrAnon_ContractCodeEntry_Ext_V1) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sext", name), XDR_ExtensionPoint(&v.Ext)) + x.Marshal(x.Sprintf("%scostInputs", name), XDR_ContractCodeCostInputs(&v.CostInputs)) +} +func XDR_XdrAnon_ContractCodeEntry_Ext_V1(v *XdrAnon_ContractCodeEntry_Ext_V1) *XdrAnon_ContractCodeEntry_Ext_V1 { + return v +} + +var _XdrTags_XdrAnon_ContractCodeEntry_Ext = map[int32]bool{ + XdrToI32(0): true, + XdrToI32(1): true, +} + +func (_ XdrAnon_ContractCodeEntry_Ext) XdrValidTags() map[int32]bool { + return _XdrTags_XdrAnon_ContractCodeEntry_Ext +} +func (u *XdrAnon_ContractCodeEntry_Ext) V1() *XdrAnon_ContractCodeEntry_Ext_V1 { + switch u.V { + case 1: + if v, ok := u._u.(*XdrAnon_ContractCodeEntry_Ext_V1); ok { + return v + } else { + var zero XdrAnon_ContractCodeEntry_Ext_V1 + u._u = &zero + return &zero + } + default: + XdrPanic("XdrAnon_ContractCodeEntry_Ext.V1 accessed when V == %v", u.V) + return nil + } +} +func (u XdrAnon_ContractCodeEntry_Ext) XdrValid() bool { + switch u.V { + case 0, 1: + return true + } + return false +} +func (u *XdrAnon_ContractCodeEntry_Ext) XdrUnionTag() XdrNum32 { + return XDR_int32(&u.V) +} +func (u *XdrAnon_ContractCodeEntry_Ext) XdrUnionTagName() string { + return "V" +} +func (u *XdrAnon_ContractCodeEntry_Ext) XdrUnionBody() XdrType { + switch u.V { + case 0: + return nil + case 1: + return XDR_XdrAnon_ContractCodeEntry_Ext_V1(u.V1()) + } + return nil +} +func (u *XdrAnon_ContractCodeEntry_Ext) XdrUnionBodyName() string { + switch u.V { + case 0: + return "" + case 1: + return "V1" + } + return "" +} + +type XdrType_XdrAnon_ContractCodeEntry_Ext = *XdrAnon_ContractCodeEntry_Ext + +func (v *XdrAnon_ContractCodeEntry_Ext) XdrPointer() interface{} { return v } +func (XdrAnon_ContractCodeEntry_Ext) XdrTypeName() string { return "XdrAnon_ContractCodeEntry_Ext" } +func (v XdrAnon_ContractCodeEntry_Ext) XdrValue() interface{} { return v } +func (v *XdrAnon_ContractCodeEntry_Ext) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *XdrAnon_ContractCodeEntry_Ext) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) + switch u.V { + case 0: + return + case 1: + x.Marshal(x.Sprintf("%sv1", name), XDR_XdrAnon_ContractCodeEntry_Ext_V1(u.V1())) + return + } + XdrPanic("invalid V (%v) in XdrAnon_ContractCodeEntry_Ext", u.V) +} +func XDR_XdrAnon_ContractCodeEntry_Ext(v *XdrAnon_ContractCodeEntry_Ext) *XdrAnon_ContractCodeEntry_Ext { + return v +} + type XdrType_ContractCodeEntry = *ContractCodeEntry func (v *ContractCodeEntry) XdrPointer() interface{} { return v } @@ -7976,7 +8215,7 @@ func (v *ContractCodeEntry) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sext", name), XDR_ExtensionPoint(&v.Ext)) + x.Marshal(x.Sprintf("%sext", name), XDR_XdrAnon_ContractCodeEntry_Ext(&v.Ext)) x.Marshal(x.Sprintf("%shash", name), XDR_Hash(&v.Hash)) x.Marshal(x.Sprintf("%scode", name), XdrVecOpaque{&v.Code, 0xffffffff}) } @@ -11779,6 +12018,102 @@ func (v *DiagnosticEvent) XdrRecurse(x XDR, name string) { } func XDR_DiagnosticEvent(v *DiagnosticEvent) *DiagnosticEvent { return v } +type XdrType_SorobanTransactionMetaExtV1 = *SorobanTransactionMetaExtV1 + +func (v *SorobanTransactionMetaExtV1) XdrPointer() interface{} { return v } +func (SorobanTransactionMetaExtV1) XdrTypeName() string { return "SorobanTransactionMetaExtV1" } +func (v SorobanTransactionMetaExtV1) XdrValue() interface{} { return v } +func (v *SorobanTransactionMetaExtV1) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *SorobanTransactionMetaExtV1) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sext", name), XDR_ExtensionPoint(&v.Ext)) + x.Marshal(x.Sprintf("%stotalNonRefundableResourceFeeCharged", name), XDR_Int64(&v.TotalNonRefundableResourceFeeCharged)) + x.Marshal(x.Sprintf("%stotalRefundableResourceFeeCharged", name), XDR_Int64(&v.TotalRefundableResourceFeeCharged)) + x.Marshal(x.Sprintf("%srentFeeCharged", name), XDR_Int64(&v.RentFeeCharged)) +} +func XDR_SorobanTransactionMetaExtV1(v *SorobanTransactionMetaExtV1) *SorobanTransactionMetaExtV1 { + return v +} + +var _XdrTags_SorobanTransactionMetaExt = map[int32]bool{ + XdrToI32(0): true, + XdrToI32(1): true, +} + +func (_ SorobanTransactionMetaExt) XdrValidTags() map[int32]bool { + return _XdrTags_SorobanTransactionMetaExt +} +func (u *SorobanTransactionMetaExt) V1() *SorobanTransactionMetaExtV1 { + switch u.V { + case 1: + if v, ok := u._u.(*SorobanTransactionMetaExtV1); ok { + return v + } else { + var zero SorobanTransactionMetaExtV1 + u._u = &zero + return &zero + } + default: + XdrPanic("SorobanTransactionMetaExt.V1 accessed when V == %v", u.V) + return nil + } +} +func (u SorobanTransactionMetaExt) XdrValid() bool { + switch u.V { + case 0, 1: + return true + } + return false +} +func (u *SorobanTransactionMetaExt) XdrUnionTag() XdrNum32 { + return XDR_int32(&u.V) +} +func (u *SorobanTransactionMetaExt) XdrUnionTagName() string { + return "V" +} +func (u *SorobanTransactionMetaExt) XdrUnionBody() XdrType { + switch u.V { + case 0: + return nil + case 1: + return XDR_SorobanTransactionMetaExtV1(u.V1()) + } + return nil +} +func (u *SorobanTransactionMetaExt) XdrUnionBodyName() string { + switch u.V { + case 0: + return "" + case 1: + return "V1" + } + return "" +} + +type XdrType_SorobanTransactionMetaExt = *SorobanTransactionMetaExt + +func (v *SorobanTransactionMetaExt) XdrPointer() interface{} { return v } +func (SorobanTransactionMetaExt) XdrTypeName() string { return "SorobanTransactionMetaExt" } +func (v SorobanTransactionMetaExt) XdrValue() interface{} { return v } +func (v *SorobanTransactionMetaExt) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *SorobanTransactionMetaExt) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) + switch u.V { + case 0: + return + case 1: + x.Marshal(x.Sprintf("%sv1", name), XDR_SorobanTransactionMetaExtV1(u.V1())) + return + } + XdrPanic("invalid V (%v) in SorobanTransactionMetaExt", u.V) +} +func XDR_SorobanTransactionMetaExt(v *SorobanTransactionMetaExt) *SorobanTransactionMetaExt { return v } + type _XdrVec_unbounded_ContractEvent []ContractEvent func (_XdrVec_unbounded_ContractEvent) XdrBound() uint32 { @@ -11903,7 +12238,7 @@ func (v *SorobanTransactionMeta) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sext", name), XDR_ExtensionPoint(&v.Ext)) + x.Marshal(x.Sprintf("%sext", name), XDR_SorobanTransactionMetaExt(&v.Ext)) x.Marshal(x.Sprintf("%sevents", name), (*_XdrVec_unbounded_ContractEvent)(&v.Events)) x.Marshal(x.Sprintf("%sreturnValue", name), XDR_SCVal(&v.ReturnValue)) x.Marshal(x.Sprintf("%sdiagnosticEvents", name), (*_XdrVec_unbounded_DiagnosticEvent)(&v.DiagnosticEvents)) @@ -12385,6 +12720,98 @@ func (v *LedgerCloseMetaV0) XdrRecurse(x XDR, name string) { } func XDR_LedgerCloseMetaV0(v *LedgerCloseMetaV0) *LedgerCloseMetaV0 { return v } +type XdrType_LedgerCloseMetaExtV1 = *LedgerCloseMetaExtV1 + +func (v *LedgerCloseMetaExtV1) XdrPointer() interface{} { return v } +func (LedgerCloseMetaExtV1) XdrTypeName() string { return "LedgerCloseMetaExtV1" } +func (v LedgerCloseMetaExtV1) XdrValue() interface{} { return v } +func (v *LedgerCloseMetaExtV1) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (v *LedgerCloseMetaExtV1) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + x.Marshal(x.Sprintf("%sext", name), XDR_ExtensionPoint(&v.Ext)) + x.Marshal(x.Sprintf("%ssorobanFeeWrite1KB", name), XDR_Int64(&v.SorobanFeeWrite1KB)) +} +func XDR_LedgerCloseMetaExtV1(v *LedgerCloseMetaExtV1) *LedgerCloseMetaExtV1 { return v } + +var _XdrTags_LedgerCloseMetaExt = map[int32]bool{ + XdrToI32(0): true, + XdrToI32(1): true, +} + +func (_ LedgerCloseMetaExt) XdrValidTags() map[int32]bool { + return _XdrTags_LedgerCloseMetaExt +} +func (u *LedgerCloseMetaExt) V1() *LedgerCloseMetaExtV1 { + switch u.V { + case 1: + if v, ok := u._u.(*LedgerCloseMetaExtV1); ok { + return v + } else { + var zero LedgerCloseMetaExtV1 + u._u = &zero + return &zero + } + default: + XdrPanic("LedgerCloseMetaExt.V1 accessed when V == %v", u.V) + return nil + } +} +func (u LedgerCloseMetaExt) XdrValid() bool { + switch u.V { + case 0, 1: + return true + } + return false +} +func (u *LedgerCloseMetaExt) XdrUnionTag() XdrNum32 { + return XDR_int32(&u.V) +} +func (u *LedgerCloseMetaExt) XdrUnionTagName() string { + return "V" +} +func (u *LedgerCloseMetaExt) XdrUnionBody() XdrType { + switch u.V { + case 0: + return nil + case 1: + return XDR_LedgerCloseMetaExtV1(u.V1()) + } + return nil +} +func (u *LedgerCloseMetaExt) XdrUnionBodyName() string { + switch u.V { + case 0: + return "" + case 1: + return "V1" + } + return "" +} + +type XdrType_LedgerCloseMetaExt = *LedgerCloseMetaExt + +func (v *LedgerCloseMetaExt) XdrPointer() interface{} { return v } +func (LedgerCloseMetaExt) XdrTypeName() string { return "LedgerCloseMetaExt" } +func (v LedgerCloseMetaExt) XdrValue() interface{} { return v } +func (v *LedgerCloseMetaExt) XdrMarshal(x XDR, name string) { x.Marshal(name, v) } +func (u *LedgerCloseMetaExt) XdrRecurse(x XDR, name string) { + if name != "" { + name = x.Sprintf("%s.", name) + } + XDR_int32(&u.V).XdrMarshal(x, x.Sprintf("%sv", name)) + switch u.V { + case 0: + return + case 1: + x.Marshal(x.Sprintf("%sv1", name), XDR_LedgerCloseMetaExtV1(u.V1())) + return + } + XdrPanic("invalid V (%v) in LedgerCloseMetaExt", u.V) +} +func XDR_LedgerCloseMetaExt(v *LedgerCloseMetaExt) *LedgerCloseMetaExt { return v } + type _XdrVec_unbounded_LedgerKey []LedgerKey func (_XdrVec_unbounded_LedgerKey) XdrBound() uint32 { @@ -12509,7 +12936,7 @@ func (v *LedgerCloseMetaV1) XdrRecurse(x XDR, name string) { if name != "" { name = x.Sprintf("%s.", name) } - x.Marshal(x.Sprintf("%sext", name), XDR_ExtensionPoint(&v.Ext)) + x.Marshal(x.Sprintf("%sext", name), XDR_LedgerCloseMetaExt(&v.Ext)) x.Marshal(x.Sprintf("%sledgerHeader", name), XDR_LedgerHeaderHistoryEntry(&v.LedgerHeader)) x.Marshal(x.Sprintf("%stxSet", name), XDR_GeneralizedTransactionSet(&v.TxSet)) x.Marshal(x.Sprintf("%stxProcessing", name), (*_XdrVec_unbounded_TransactionResultMeta)(&v.TxProcessing)) @@ -28467,54 +28894,98 @@ func XDR_ConfigSettingContractBandwidthV0(v *ConfigSettingContractBandwidthV0) * } var _XdrNames_ContractCostType = map[int32]string{ - int32(WasmInsnExec): "WasmInsnExec", - int32(MemAlloc): "MemAlloc", - int32(MemCpy): "MemCpy", - int32(MemCmp): "MemCmp", - int32(DispatchHostFunction): "DispatchHostFunction", - int32(VisitObject): "VisitObject", - int32(ValSer): "ValSer", - int32(ValDeser): "ValDeser", - int32(ComputeSha256Hash): "ComputeSha256Hash", - int32(ComputeEd25519PubKey): "ComputeEd25519PubKey", - int32(VerifyEd25519Sig): "VerifyEd25519Sig", - int32(VmInstantiation): "VmInstantiation", - int32(VmCachedInstantiation): "VmCachedInstantiation", - int32(InvokeVmFunction): "InvokeVmFunction", - int32(ComputeKeccak256Hash): "ComputeKeccak256Hash", - int32(ComputeEcdsaSecp256k1Sig): "ComputeEcdsaSecp256k1Sig", - int32(RecoverEcdsaSecp256k1Key): "RecoverEcdsaSecp256k1Key", - int32(Int256AddSub): "Int256AddSub", - int32(Int256Mul): "Int256Mul", - int32(Int256Div): "Int256Div", - int32(Int256Pow): "Int256Pow", - int32(Int256Shift): "Int256Shift", - int32(ChaCha20DrawBytes): "ChaCha20DrawBytes", + int32(WasmInsnExec): "WasmInsnExec", + int32(MemAlloc): "MemAlloc", + int32(MemCpy): "MemCpy", + int32(MemCmp): "MemCmp", + int32(DispatchHostFunction): "DispatchHostFunction", + int32(VisitObject): "VisitObject", + int32(ValSer): "ValSer", + int32(ValDeser): "ValDeser", + int32(ComputeSha256Hash): "ComputeSha256Hash", + int32(ComputeEd25519PubKey): "ComputeEd25519PubKey", + int32(VerifyEd25519Sig): "VerifyEd25519Sig", + int32(VmInstantiation): "VmInstantiation", + int32(VmCachedInstantiation): "VmCachedInstantiation", + int32(InvokeVmFunction): "InvokeVmFunction", + int32(ComputeKeccak256Hash): "ComputeKeccak256Hash", + int32(DecodeEcdsaCurve256Sig): "DecodeEcdsaCurve256Sig", + int32(RecoverEcdsaSecp256k1Key): "RecoverEcdsaSecp256k1Key", + int32(Int256AddSub): "Int256AddSub", + int32(Int256Mul): "Int256Mul", + int32(Int256Div): "Int256Div", + int32(Int256Pow): "Int256Pow", + int32(Int256Shift): "Int256Shift", + int32(ChaCha20DrawBytes): "ChaCha20DrawBytes", + int32(ParseWasmInstructions): "ParseWasmInstructions", + int32(ParseWasmFunctions): "ParseWasmFunctions", + int32(ParseWasmGlobals): "ParseWasmGlobals", + int32(ParseWasmTableEntries): "ParseWasmTableEntries", + int32(ParseWasmTypes): "ParseWasmTypes", + int32(ParseWasmDataSegments): "ParseWasmDataSegments", + int32(ParseWasmElemSegments): "ParseWasmElemSegments", + int32(ParseWasmImports): "ParseWasmImports", + int32(ParseWasmExports): "ParseWasmExports", + int32(ParseWasmDataSegmentBytes): "ParseWasmDataSegmentBytes", + int32(InstantiateWasmInstructions): "InstantiateWasmInstructions", + int32(InstantiateWasmFunctions): "InstantiateWasmFunctions", + int32(InstantiateWasmGlobals): "InstantiateWasmGlobals", + int32(InstantiateWasmTableEntries): "InstantiateWasmTableEntries", + int32(InstantiateWasmTypes): "InstantiateWasmTypes", + int32(InstantiateWasmDataSegments): "InstantiateWasmDataSegments", + int32(InstantiateWasmElemSegments): "InstantiateWasmElemSegments", + int32(InstantiateWasmImports): "InstantiateWasmImports", + int32(InstantiateWasmExports): "InstantiateWasmExports", + int32(InstantiateWasmDataSegmentBytes): "InstantiateWasmDataSegmentBytes", + int32(Sec1DecodePointUncompressed): "Sec1DecodePointUncompressed", + int32(VerifyEcdsaSecp256r1Sig): "VerifyEcdsaSecp256r1Sig", } var _XdrValues_ContractCostType = map[string]int32{ - "WasmInsnExec": int32(WasmInsnExec), - "MemAlloc": int32(MemAlloc), - "MemCpy": int32(MemCpy), - "MemCmp": int32(MemCmp), - "DispatchHostFunction": int32(DispatchHostFunction), - "VisitObject": int32(VisitObject), - "ValSer": int32(ValSer), - "ValDeser": int32(ValDeser), - "ComputeSha256Hash": int32(ComputeSha256Hash), - "ComputeEd25519PubKey": int32(ComputeEd25519PubKey), - "VerifyEd25519Sig": int32(VerifyEd25519Sig), - "VmInstantiation": int32(VmInstantiation), - "VmCachedInstantiation": int32(VmCachedInstantiation), - "InvokeVmFunction": int32(InvokeVmFunction), - "ComputeKeccak256Hash": int32(ComputeKeccak256Hash), - "ComputeEcdsaSecp256k1Sig": int32(ComputeEcdsaSecp256k1Sig), - "RecoverEcdsaSecp256k1Key": int32(RecoverEcdsaSecp256k1Key), - "Int256AddSub": int32(Int256AddSub), - "Int256Mul": int32(Int256Mul), - "Int256Div": int32(Int256Div), - "Int256Pow": int32(Int256Pow), - "Int256Shift": int32(Int256Shift), - "ChaCha20DrawBytes": int32(ChaCha20DrawBytes), + "WasmInsnExec": int32(WasmInsnExec), + "MemAlloc": int32(MemAlloc), + "MemCpy": int32(MemCpy), + "MemCmp": int32(MemCmp), + "DispatchHostFunction": int32(DispatchHostFunction), + "VisitObject": int32(VisitObject), + "ValSer": int32(ValSer), + "ValDeser": int32(ValDeser), + "ComputeSha256Hash": int32(ComputeSha256Hash), + "ComputeEd25519PubKey": int32(ComputeEd25519PubKey), + "VerifyEd25519Sig": int32(VerifyEd25519Sig), + "VmInstantiation": int32(VmInstantiation), + "VmCachedInstantiation": int32(VmCachedInstantiation), + "InvokeVmFunction": int32(InvokeVmFunction), + "ComputeKeccak256Hash": int32(ComputeKeccak256Hash), + "DecodeEcdsaCurve256Sig": int32(DecodeEcdsaCurve256Sig), + "RecoverEcdsaSecp256k1Key": int32(RecoverEcdsaSecp256k1Key), + "Int256AddSub": int32(Int256AddSub), + "Int256Mul": int32(Int256Mul), + "Int256Div": int32(Int256Div), + "Int256Pow": int32(Int256Pow), + "Int256Shift": int32(Int256Shift), + "ChaCha20DrawBytes": int32(ChaCha20DrawBytes), + "ParseWasmInstructions": int32(ParseWasmInstructions), + "ParseWasmFunctions": int32(ParseWasmFunctions), + "ParseWasmGlobals": int32(ParseWasmGlobals), + "ParseWasmTableEntries": int32(ParseWasmTableEntries), + "ParseWasmTypes": int32(ParseWasmTypes), + "ParseWasmDataSegments": int32(ParseWasmDataSegments), + "ParseWasmElemSegments": int32(ParseWasmElemSegments), + "ParseWasmImports": int32(ParseWasmImports), + "ParseWasmExports": int32(ParseWasmExports), + "ParseWasmDataSegmentBytes": int32(ParseWasmDataSegmentBytes), + "InstantiateWasmInstructions": int32(InstantiateWasmInstructions), + "InstantiateWasmFunctions": int32(InstantiateWasmFunctions), + "InstantiateWasmGlobals": int32(InstantiateWasmGlobals), + "InstantiateWasmTableEntries": int32(InstantiateWasmTableEntries), + "InstantiateWasmTypes": int32(InstantiateWasmTypes), + "InstantiateWasmDataSegments": int32(InstantiateWasmDataSegments), + "InstantiateWasmElemSegments": int32(InstantiateWasmElemSegments), + "InstantiateWasmImports": int32(InstantiateWasmImports), + "InstantiateWasmExports": int32(InstantiateWasmExports), + "InstantiateWasmDataSegmentBytes": int32(InstantiateWasmDataSegmentBytes), + "Sec1DecodePointUncompressed": int32(Sec1DecodePointUncompressed), + "VerifyEcdsaSecp256r1Sig": int32(VerifyEcdsaSecp256r1Sig), } func (ContractCostType) XdrEnumNames() map[int32]string { @@ -28554,29 +29025,51 @@ type XdrType_ContractCostType = *ContractCostType func XDR_ContractCostType(v *ContractCostType) *ContractCostType { return v } var _XdrComments_ContractCostType = map[int32]string{ - int32(WasmInsnExec): "Cost of running 1 wasm instruction", - int32(MemAlloc): "Cost of allocating a slice of memory (in bytes)", - int32(MemCpy): "Cost of copying a slice of bytes into a pre-allocated memory", - int32(MemCmp): "Cost of comparing two slices of memory", - int32(DispatchHostFunction): "Cost of a host function dispatch, not including the actual work done by the function nor the cost of VM invocation machinary", - int32(VisitObject): "Cost of visiting a host object from the host object storage. Exists to make sure some baseline cost coverage, i.e. repeatly visiting objects by the guest will always incur some charges.", - int32(ValSer): "Cost of serializing an xdr object to bytes", - int32(ValDeser): "Cost of deserializing an xdr object from bytes", - int32(ComputeSha256Hash): "Cost of computing the sha256 hash from bytes", - int32(ComputeEd25519PubKey): "Cost of computing the ed25519 pubkey from bytes", - int32(VerifyEd25519Sig): "Cost of verifying ed25519 signature of a payload.", - int32(VmInstantiation): "Cost of instantiation a VM from wasm bytes code.", - int32(VmCachedInstantiation): "Cost of instantiation a VM from a cached state.", - int32(InvokeVmFunction): "Cost of invoking a function on the VM. If the function is a host function, additional cost will be covered by `DispatchHostFunction`.", - int32(ComputeKeccak256Hash): "Cost of computing a keccak256 hash from bytes.", - int32(ComputeEcdsaSecp256k1Sig): "Cost of computing an ECDSA secp256k1 signature from bytes.", - int32(RecoverEcdsaSecp256k1Key): "Cost of recovering an ECDSA secp256k1 key from a signature.", - int32(Int256AddSub): "Cost of int256 addition (`+`) and subtraction (`-`) operations", - int32(Int256Mul): "Cost of int256 multiplication (`*`) operation", - int32(Int256Div): "Cost of int256 division (`/`) operation", - int32(Int256Pow): "Cost of int256 power (`exp`) operation", - int32(Int256Shift): "Cost of int256 shift (`shl`, `shr`) operation", - int32(ChaCha20DrawBytes): "Cost of drawing random bytes using a ChaCha20 PRNG", + int32(WasmInsnExec): "Cost of running 1 wasm instruction", + int32(MemAlloc): "Cost of allocating a slice of memory (in bytes)", + int32(MemCpy): "Cost of copying a slice of bytes into a pre-allocated memory", + int32(MemCmp): "Cost of comparing two slices of memory", + int32(DispatchHostFunction): "Cost of a host function dispatch, not including the actual work done by the function nor the cost of VM invocation machinary", + int32(VisitObject): "Cost of visiting a host object from the host object storage. Exists to make sure some baseline cost coverage, i.e. repeatly visiting objects by the guest will always incur some charges.", + int32(ValSer): "Cost of serializing an xdr object to bytes", + int32(ValDeser): "Cost of deserializing an xdr object from bytes", + int32(ComputeSha256Hash): "Cost of computing the sha256 hash from bytes", + int32(ComputeEd25519PubKey): "Cost of computing the ed25519 pubkey from bytes", + int32(VerifyEd25519Sig): "Cost of verifying ed25519 signature of a payload.", + int32(VmInstantiation): "Cost of instantiation a VM from wasm bytes code.", + int32(VmCachedInstantiation): "Cost of instantiation a VM from a cached state.", + int32(InvokeVmFunction): "Cost of invoking a function on the VM. If the function is a host function, additional cost will be covered by `DispatchHostFunction`.", + int32(ComputeKeccak256Hash): "Cost of computing a keccak256 hash from bytes.", + int32(DecodeEcdsaCurve256Sig): "Cost of decoding an ECDSA signature computed from a 256-bit prime modulus curve (e.g. secp256k1 and secp256r1)", + int32(RecoverEcdsaSecp256k1Key): "Cost of recovering an ECDSA secp256k1 key from a signature.", + int32(Int256AddSub): "Cost of int256 addition (`+`) and subtraction (`-`) operations", + int32(Int256Mul): "Cost of int256 multiplication (`*`) operation", + int32(Int256Div): "Cost of int256 division (`/`) operation", + int32(Int256Pow): "Cost of int256 power (`exp`) operation", + int32(Int256Shift): "Cost of int256 shift (`shl`, `shr`) operation", + int32(ChaCha20DrawBytes): "Cost of drawing random bytes using a ChaCha20 PRNG", + int32(ParseWasmInstructions): "Cost of parsing wasm bytes that only encode instructions.", + int32(ParseWasmFunctions): "Cost of parsing a known number of wasm functions.", + int32(ParseWasmGlobals): "Cost of parsing a known number of wasm globals.", + int32(ParseWasmTableEntries): "Cost of parsing a known number of wasm table entries.", + int32(ParseWasmTypes): "Cost of parsing a known number of wasm types.", + int32(ParseWasmDataSegments): "Cost of parsing a known number of wasm data segments.", + int32(ParseWasmElemSegments): "Cost of parsing a known number of wasm element segments.", + int32(ParseWasmImports): "Cost of parsing a known number of wasm imports.", + int32(ParseWasmExports): "Cost of parsing a known number of wasm exports.", + int32(ParseWasmDataSegmentBytes): "Cost of parsing a known number of data segment bytes.", + int32(InstantiateWasmInstructions): "Cost of instantiating wasm bytes that only encode instructions.", + int32(InstantiateWasmFunctions): "Cost of instantiating a known number of wasm functions.", + int32(InstantiateWasmGlobals): "Cost of instantiating a known number of wasm globals.", + int32(InstantiateWasmTableEntries): "Cost of instantiating a known number of wasm table entries.", + int32(InstantiateWasmTypes): "Cost of instantiating a known number of wasm types.", + int32(InstantiateWasmDataSegments): "Cost of instantiating a known number of wasm data segments.", + int32(InstantiateWasmElemSegments): "Cost of instantiating a known number of wasm element segments.", + int32(InstantiateWasmImports): "Cost of instantiating a known number of wasm imports.", + int32(InstantiateWasmExports): "Cost of instantiating a known number of wasm exports.", + 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", } func (e ContractCostType) XdrEnumComments() map[int32]string { diff --git a/services/horizon/internal/ingest/main.go b/services/horizon/internal/ingest/main.go index 127d8f0293..fe9c62eba4 100644 --- a/services/horizon/internal/ingest/main.go +++ b/services/horizon/internal/ingest/main.go @@ -29,7 +29,7 @@ import ( const ( // MaxSupportedProtocolVersion defines the maximum supported version of // the Stellar protocol. - MaxSupportedProtocolVersion uint32 = 20 + MaxSupportedProtocolVersion uint32 = 21 // CurrentVersion reflects the latest version of the ingestion // algorithm. This value is stored in KV store and is used to decide diff --git a/services/horizon/internal/integration/extend_footprint_ttl_test.go b/services/horizon/internal/integration/extend_footprint_ttl_test.go index e280184b65..cc6f947a14 100644 --- a/services/horizon/internal/integration/extend_footprint_ttl_test.go +++ b/services/horizon/internal/integration/extend_footprint_ttl_test.go @@ -17,7 +17,6 @@ func TestExtendFootprintTtl(t *testing.T) { } itest := integration.NewTest(t, integration.Config{ - ProtocolVersion: 20, EnableSorobanRPC: true, }) diff --git a/services/horizon/internal/integration/invokehostfunction_test.go b/services/horizon/internal/integration/invokehostfunction_test.go index 275f0de23b..6447b98147 100644 --- a/services/horizon/internal/integration/invokehostfunction_test.go +++ b/services/horizon/internal/integration/invokehostfunction_test.go @@ -30,7 +30,6 @@ func TestContractInvokeHostFunctionInstallContract(t *testing.T) { } itest := integration.NewTest(t, integration.Config{ - ProtocolVersion: 20, EnableSorobanRPC: true, }) @@ -80,7 +79,6 @@ func TestContractInvokeHostFunctionCreateContractByAddress(t *testing.T) { } itest := integration.NewTest(t, integration.Config{ - ProtocolVersion: 20, EnableSorobanRPC: true, }) @@ -134,7 +132,6 @@ func TestContractInvokeHostFunctionInvokeStatelessContractFn(t *testing.T) { } itest := integration.NewTest(t, integration.Config{ - ProtocolVersion: 20, EnableSorobanRPC: true, }) @@ -243,7 +240,6 @@ func TestContractInvokeHostFunctionInvokeStatefulContractFn(t *testing.T) { } itest := integration.NewTest(t, integration.Config{ - ProtocolVersion: 20, EnableSorobanRPC: true, }) diff --git a/services/horizon/internal/integration/sac_test.go b/services/horizon/internal/integration/sac_test.go index 64c772b44c..7eb91a201c 100644 --- a/services/horizon/internal/integration/sac_test.go +++ b/services/horizon/internal/integration/sac_test.go @@ -40,7 +40,6 @@ func TestContractMintToAccount(t *testing.T) { } itest := integration.NewTest(t, integration.Config{ - ProtocolVersion: 20, HorizonEnvironment: map[string]string{"INGEST_DISABLE_STATE_VERIFICATION": "true", "CONNECTION_TIMEOUT": "360000"}, EnableSorobanRPC: true, }) @@ -145,7 +144,6 @@ func TestContractMintToContract(t *testing.T) { } itest := integration.NewTest(t, integration.Config{ - ProtocolVersion: 20, EnableSorobanRPC: true, }) @@ -225,7 +223,6 @@ func TestExpirationAndRestoration(t *testing.T) { } itest := integration.NewTest(t, integration.Config{ - ProtocolVersion: 20, EnableSorobanRPC: true, HorizonIngestParameters: map[string]string{ // disable state verification because we will insert @@ -506,7 +503,6 @@ func TestContractTransferBetweenAccounts(t *testing.T) { } itest := integration.NewTest(t, integration.Config{ - ProtocolVersion: 20, EnableSorobanRPC: true, }) @@ -581,7 +577,6 @@ func TestContractTransferBetweenAccountAndContract(t *testing.T) { } itest := integration.NewTest(t, integration.Config{ - ProtocolVersion: 20, EnableSorobanRPC: true, }) @@ -702,7 +697,6 @@ func TestContractTransferBetweenContracts(t *testing.T) { } itest := integration.NewTest(t, integration.Config{ - ProtocolVersion: 20, EnableSorobanRPC: true, }) @@ -784,7 +778,6 @@ func TestContractBurnFromAccount(t *testing.T) { } itest := integration.NewTest(t, integration.Config{ - ProtocolVersion: 20, EnableSorobanRPC: true, }) @@ -860,7 +853,6 @@ func TestContractBurnFromContract(t *testing.T) { } itest := integration.NewTest(t, integration.Config{ - ProtocolVersion: 20, EnableSorobanRPC: true, }) @@ -928,7 +920,6 @@ func TestContractClawbackFromAccount(t *testing.T) { } itest := integration.NewTest(t, integration.Config{ - ProtocolVersion: 20, EnableSorobanRPC: true, }) @@ -1006,7 +997,6 @@ func TestContractClawbackFromContract(t *testing.T) { } itest := integration.NewTest(t, integration.Config{ - ProtocolVersion: 20, EnableSorobanRPC: true, }) diff --git a/services/horizon/internal/integration/transaction_test.go b/services/horizon/internal/integration/transaction_test.go index a0db5816dd..8c3fa369fb 100644 --- a/services/horizon/internal/integration/transaction_test.go +++ b/services/horizon/internal/integration/transaction_test.go @@ -72,7 +72,6 @@ func TestP20MetaTransaction(t *testing.T) { } itest := integration.NewTest(t, integration.Config{ - ProtocolVersion: 20, EnableSorobanRPC: true, }) @@ -102,7 +101,6 @@ func TestP20MetaDisabledTransaction(t *testing.T) { } itest := integration.NewTest(t, integration.Config{ - ProtocolVersion: 20, HorizonEnvironment: map[string]string{"SKIP_TXMETA": "TRUE"}, EnableSorobanRPC: true, }) diff --git a/services/horizon/internal/integration/txsub_test.go b/services/horizon/internal/integration/txsub_test.go index 2f6b98e905..e253522893 100644 --- a/services/horizon/internal/integration/txsub_test.go +++ b/services/horizon/internal/integration/txsub_test.go @@ -60,7 +60,6 @@ func TestTxSubLimitsBodySize(t *testing.T) { } itest := integration.NewTest(t, integration.Config{ - ProtocolVersion: 20, EnableSorobanRPC: true, HorizonEnvironment: map[string]string{ "MAX_HTTP_REQUEST_SIZE": "1800", diff --git a/xdr/Stellar-contract-config-setting.x b/xdr/Stellar-contract-config-setting.x index 6b5074735d..52cc0224df 100644 --- a/xdr/Stellar-contract-config-setting.x +++ b/xdr/Stellar-contract-config-setting.x @@ -124,8 +124,9 @@ enum ContractCostType { InvokeVmFunction = 13, // Cost of computing a keccak256 hash from bytes. ComputeKeccak256Hash = 14, - // Cost of computing an ECDSA secp256k1 signature from bytes. - ComputeEcdsaSecp256k1Sig = 15, + // Cost of decoding an ECDSA signature computed from a 256-bit prime modulus + // curve (e.g. secp256k1 and secp256r1) + DecodeEcdsaCurve256Sig = 15, // Cost of recovering an ECDSA secp256k1 key from a signature. RecoverEcdsaSecp256k1Key = 16, // Cost of int256 addition (`+`) and subtraction (`-`) operations @@ -139,7 +140,55 @@ enum ContractCostType { // Cost of int256 shift (`shl`, `shr`) operation Int256Shift = 21, // Cost of drawing random bytes using a ChaCha20 PRNG - ChaCha20DrawBytes = 22 + ChaCha20DrawBytes = 22, + + // Cost of parsing wasm bytes that only encode instructions. + ParseWasmInstructions = 23, + // Cost of parsing a known number of wasm functions. + ParseWasmFunctions = 24, + // Cost of parsing a known number of wasm globals. + ParseWasmGlobals = 25, + // Cost of parsing a known number of wasm table entries. + ParseWasmTableEntries = 26, + // Cost of parsing a known number of wasm types. + ParseWasmTypes = 27, + // Cost of parsing a known number of wasm data segments. + ParseWasmDataSegments = 28, + // Cost of parsing a known number of wasm element segments. + ParseWasmElemSegments = 29, + // Cost of parsing a known number of wasm imports. + ParseWasmImports = 30, + // Cost of parsing a known number of wasm exports. + ParseWasmExports = 31, + // Cost of parsing a known number of data segment bytes. + ParseWasmDataSegmentBytes = 32, + + // Cost of instantiating wasm bytes that only encode instructions. + InstantiateWasmInstructions = 33, + // Cost of instantiating a known number of wasm functions. + InstantiateWasmFunctions = 34, + // Cost of instantiating a known number of wasm globals. + InstantiateWasmGlobals = 35, + // Cost of instantiating a known number of wasm table entries. + InstantiateWasmTableEntries = 36, + // Cost of instantiating a known number of wasm types. + InstantiateWasmTypes = 37, + // Cost of instantiating a known number of wasm data segments. + InstantiateWasmDataSegments = 38, + // Cost of instantiating a known number of wasm element segments. + InstantiateWasmElemSegments = 39, + // Cost of instantiating a known number of wasm imports. + InstantiateWasmImports = 40, + // Cost of instantiating a known number of wasm exports. + InstantiateWasmExports = 41, + // Cost of instantiating a known number of data segment bytes. + InstantiateWasmDataSegmentBytes = 42, + + // Cost of decoding a bytes array representing an uncompressed SEC-1 encoded + // point on a 256-bit elliptic curve + Sec1DecodePointUncompressed = 43, + // Cost of verifying an ECDSA Secp256r1 signature + VerifyEcdsaSecp256r1Sig = 44 }; struct ContractCostParamEntry { diff --git a/xdr/Stellar-ledger-entries.x b/xdr/Stellar-ledger-entries.x index 8a8784e2bb..3a137ae60d 100644 --- a/xdr/Stellar-ledger-entries.x +++ b/xdr/Stellar-ledger-entries.x @@ -508,8 +508,32 @@ struct ContractDataEntry { SCVal val; }; -struct ContractCodeEntry { +struct ContractCodeCostInputs { ExtensionPoint ext; + uint32 nInstructions; + uint32 nFunctions; + uint32 nGlobals; + uint32 nTableEntries; + uint32 nTypes; + uint32 nDataSegments; + uint32 nElemSegments; + uint32 nImports; + uint32 nExports; + uint32 nDataSegmentBytes; +}; + +struct ContractCodeEntry { + union switch (int v) + { + case 0: + void; + case 1: + struct + { + ExtensionPoint ext; + ContractCodeCostInputs costInputs; + } v1; + } ext; Hash hash; opaque code<>; diff --git a/xdr/Stellar-ledger.x b/xdr/Stellar-ledger.x index b18a3a0d57..dd58ae8d9e 100644 --- a/xdr/Stellar-ledger.x +++ b/xdr/Stellar-ledger.x @@ -400,10 +400,52 @@ struct DiagnosticEvent ContractEvent event; }; -struct SorobanTransactionMeta +struct SorobanTransactionMetaExtV1 { ExtensionPoint ext; + // The following are the components of the overall Soroban resource fee + // charged for the transaction. + // The following relation holds: + // `resourceFeeCharged = totalNonRefundableResourceFeeCharged + totalRefundableResourceFeeCharged` + // where `resourceFeeCharged` is the overall fee charged for the + // transaction. Also, `resourceFeeCharged` <= `sorobanData.resourceFee` + // i.e.we never charge more than the declared resource fee. + // The inclusion fee for charged the Soroban transaction can be found using + // the following equation: + // `result.feeCharged = resourceFeeCharged + inclusionFeeCharged`. + + // Total amount (in stroops) that has been charged for non-refundable + // Soroban resources. + // Non-refundable resources are charged based on the usage declared in + // the transaction envelope (such as `instructions`, `readBytes` etc.) and + // is charged regardless of the success of the transaction. + int64 totalNonRefundableResourceFeeCharged; + // Total amount (in stroops) that has been charged for refundable + // Soroban resource fees. + // Currently this comprises the rent fee (`rentFeeCharged`) and the + // fee for the events and return value. + // Refundable resources are charged based on the actual resources usage. + // Since currently refundable resources are only used for the successful + // transactions, this will be `0` for failed transactions. + int64 totalRefundableResourceFeeCharged; + // Amount (in stroops) that has been charged for rent. + // This is a part of `totalNonRefundableResourceFeeCharged`. + int64 rentFeeCharged; +}; + +union SorobanTransactionMetaExt switch (int v) +{ +case 0: + void; +case 1: + SorobanTransactionMetaExtV1 v1; +}; + +struct SorobanTransactionMeta +{ + SorobanTransactionMetaExt ext; + ContractEvent events<>; // custom events populated by the // contracts themselves. SCVal returnValue; // return value of the host fn invocation @@ -484,11 +526,23 @@ struct LedgerCloseMetaV0 SCPHistoryEntry scpInfo<>; }; -struct LedgerCloseMetaV1 +struct LedgerCloseMetaExtV1 { - // We forgot to add an ExtensionPoint in v0 but at least - // we can add one now in v1. ExtensionPoint ext; + int64 sorobanFeeWrite1KB; +}; + +union LedgerCloseMetaExt switch (int v) +{ +case 0: + void; +case 1: + LedgerCloseMetaExtV1 v1; +}; + +struct LedgerCloseMetaV1 +{ + LedgerCloseMetaExt ext; LedgerHeaderHistoryEntry ledgerHeader; diff --git a/xdr/xdr_commit_generated.txt b/xdr/xdr_commit_generated.txt index b7c3979571..610c71d294 100644 --- a/xdr/xdr_commit_generated.txt +++ b/xdr/xdr_commit_generated.txt @@ -1 +1 @@ -b96148cd4acc372cc9af17b909ffe4b12c43ecb6 \ No newline at end of file +59062438237d5f77fd6feb060b76288e88b7e222 \ No newline at end of file diff --git a/xdr/xdr_generated.go b/xdr/xdr_generated.go index ad832d79b4..b336714562 100644 --- a/xdr/xdr_generated.go +++ b/xdr/xdr_generated.go @@ -34,15 +34,15 @@ 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": "fc42980e8710514679477f767ecad6f9348c38d24b1e4476fdd7e73e8e672ea8", + "xdr/Stellar-contract-config-setting.x": "393369678663cb0f9471a0b69e2a9cfa3ac93c4415fa40cec166e9a231ecbe0d", "xdr/Stellar-contract-env-meta.x": "928a30de814ee589bc1d2aadd8dd81c39f71b7e6f430f56974505ccb1f49654b", "xdr/Stellar-contract-meta.x": "f01532c11ca044e19d9f9f16fe373e9af64835da473be556b9a807ee3319ae0d", "xdr/Stellar-contract-spec.x": "c7ffa21d2e91afb8e666b33524d307955426ff553a486d670c29217ed9888d49", "xdr/Stellar-contract.x": "7f665e4103e146a88fcdabce879aaaacd3bf9283feb194cc47ff986264c1e315", "xdr/Stellar-exporter.x": "a00c83d02e8c8382e06f79a191f1fb5abd097a4bbcab8481c67467e3270e0529", "xdr/Stellar-internal.x": "227835866c1b2122d1eaf28839ba85ea7289d1cb681dda4ca619c2da3d71fe00", - "xdr/Stellar-ledger-entries.x": "4f8f2324f567a40065f54f696ea1428740f043ea4154f5986d9f499ad00ac333", - "xdr/Stellar-ledger.x": "2c842f3fe6e269498af5467f849cf6818554e90babc845f34c87cda471298d0f", + "xdr/Stellar-ledger-entries.x": "77dc7062ae6d0812136333e12e35b2294d7c2896a536be9c811eb0ed2abbbccb", + "xdr/Stellar-ledger.x": "888152fb940b79a01ac00a5218ca91360cb0f01af7acc030d5805ebfec280203", "xdr/Stellar-lighthorizon.x": "1aac09eaeda224154f653a0c95f02167be0c110fc295bb41b756a080eb8c06df", "xdr/Stellar-overlay.x": "de3957c58b96ae07968b3d3aebea84f83603e95322d1fa336360e13e3aba737a", "xdr/Stellar-transaction.x": "0d2b35a331a540b48643925d0869857236eb2487c02d340ea32e365e784ea2b8", @@ -8049,16 +8049,421 @@ func (s ContractDataEntry) xdrType() {} var _ xdrType = (*ContractDataEntry)(nil) +// ContractCodeCostInputs is an XDR Struct defines as: +// +// struct ContractCodeCostInputs { +// ExtensionPoint ext; +// uint32 nInstructions; +// uint32 nFunctions; +// uint32 nGlobals; +// uint32 nTableEntries; +// uint32 nTypes; +// uint32 nDataSegments; +// uint32 nElemSegments; +// uint32 nImports; +// uint32 nExports; +// uint32 nDataSegmentBytes; +// }; +type ContractCodeCostInputs struct { + Ext ExtensionPoint + NInstructions Uint32 + NFunctions Uint32 + NGlobals Uint32 + NTableEntries Uint32 + NTypes Uint32 + NDataSegments Uint32 + NElemSegments Uint32 + NImports Uint32 + NExports Uint32 + NDataSegmentBytes Uint32 +} + +// EncodeTo encodes this value using the Encoder. +func (s *ContractCodeCostInputs) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.Ext.EncodeTo(e); err != nil { + return err + } + if err = s.NInstructions.EncodeTo(e); err != nil { + return err + } + if err = s.NFunctions.EncodeTo(e); err != nil { + return err + } + if err = s.NGlobals.EncodeTo(e); err != nil { + return err + } + if err = s.NTableEntries.EncodeTo(e); err != nil { + return err + } + if err = s.NTypes.EncodeTo(e); err != nil { + return err + } + if err = s.NDataSegments.EncodeTo(e); err != nil { + return err + } + if err = s.NElemSegments.EncodeTo(e); err != nil { + return err + } + if err = s.NImports.EncodeTo(e); err != nil { + return err + } + if err = s.NExports.EncodeTo(e); err != nil { + return err + } + if err = s.NDataSegmentBytes.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*ContractCodeCostInputs)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *ContractCodeCostInputs) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding ContractCodeCostInputs: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.Ext.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ExtensionPoint: %w", err) + } + nTmp, err = s.NInstructions.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.NFunctions.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.NGlobals.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.NTableEntries.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.NTypes.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.NDataSegments.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.NElemSegments.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.NImports.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.NExports.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Uint32: %w", err) + } + nTmp, err = s.NDataSegmentBytes.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 ContractCodeCostInputs) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *ContractCodeCostInputs) 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 = (*ContractCodeCostInputs)(nil) + _ encoding.BinaryUnmarshaler = (*ContractCodeCostInputs)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s ContractCodeCostInputs) xdrType() {} + +var _ xdrType = (*ContractCodeCostInputs)(nil) + +// ContractCodeEntryV1 is an XDR NestedStruct defines as: +// +// struct +// { +// ExtensionPoint ext; +// ContractCodeCostInputs costInputs; +// } +type ContractCodeEntryV1 struct { + Ext ExtensionPoint + CostInputs ContractCodeCostInputs +} + +// EncodeTo encodes this value using the Encoder. +func (s *ContractCodeEntryV1) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.Ext.EncodeTo(e); err != nil { + return err + } + if err = s.CostInputs.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*ContractCodeEntryV1)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *ContractCodeEntryV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding ContractCodeEntryV1: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.Ext.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ExtensionPoint: %w", err) + } + nTmp, err = s.CostInputs.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ContractCodeCostInputs: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s ContractCodeEntryV1) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *ContractCodeEntryV1) 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 = (*ContractCodeEntryV1)(nil) + _ encoding.BinaryUnmarshaler = (*ContractCodeEntryV1)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s ContractCodeEntryV1) xdrType() {} + +var _ xdrType = (*ContractCodeEntryV1)(nil) + +// ContractCodeEntryExt is an XDR NestedUnion defines as: +// +// union switch (int v) +// { +// case 0: +// void; +// case 1: +// struct +// { +// ExtensionPoint ext; +// ContractCodeCostInputs costInputs; +// } v1; +// } +type ContractCodeEntryExt struct { + V int32 + V1 *ContractCodeEntryV1 +} + +// SwitchFieldName returns the field name in which this union's +// discriminant is stored +func (u ContractCodeEntryExt) SwitchFieldName() string { + return "V" +} + +// ArmForSwitch returns which field name should be used for storing +// the value for an instance of ContractCodeEntryExt +func (u ContractCodeEntryExt) ArmForSwitch(sw int32) (string, bool) { + switch int32(sw) { + case 0: + return "", true + case 1: + return "V1", true + } + return "-", false +} + +// NewContractCodeEntryExt creates a new ContractCodeEntryExt. +func NewContractCodeEntryExt(v int32, value interface{}) (result ContractCodeEntryExt, err error) { + result.V = v + switch int32(v) { + case 0: + // void + case 1: + tv, ok := value.(ContractCodeEntryV1) + if !ok { + err = errors.New("invalid value, must be ContractCodeEntryV1") + return + } + result.V1 = &tv + } + return +} + +// MustV1 retrieves the V1 value from the union, +// panicing if the value is not set. +func (u ContractCodeEntryExt) MustV1() ContractCodeEntryV1 { + val, ok := u.GetV1() + + if !ok { + panic("arm V1 is not set") + } + + return val +} + +// GetV1 retrieves the V1 value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u ContractCodeEntryExt) GetV1() (result ContractCodeEntryV1, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.V)) + + if armName == "V1" { + result = *u.V1 + ok = true + } + + return +} + +// EncodeTo encodes this value using the Encoder. +func (u ContractCodeEntryExt) EncodeTo(e *xdr.Encoder) error { + var err error + if _, err = e.EncodeInt(int32(u.V)); err != nil { + return err + } + switch int32(u.V) { + case 0: + // Void + return nil + case 1: + if err = (*u.V1).EncodeTo(e); err != nil { + return err + } + return nil + } + return fmt.Errorf("V (int32) switch value '%d' is not valid for union ContractCodeEntryExt", u.V) +} + +var _ decoderFrom = (*ContractCodeEntryExt)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (u *ContractCodeEntryExt) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding ContractCodeEntryExt: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + u.V, nTmp, err = d.DecodeInt() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Int: %w", err) + } + switch int32(u.V) { + case 0: + // Void + return n, nil + case 1: + u.V1 = new(ContractCodeEntryV1) + nTmp, err = (*u.V1).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ContractCodeEntryV1: %w", err) + } + return n, nil + } + return n, fmt.Errorf("union ContractCodeEntryExt has invalid V (int32) switch value '%d'", u.V) +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s ContractCodeEntryExt) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *ContractCodeEntryExt) 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 = (*ContractCodeEntryExt)(nil) + _ encoding.BinaryUnmarshaler = (*ContractCodeEntryExt)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s ContractCodeEntryExt) xdrType() {} + +var _ xdrType = (*ContractCodeEntryExt)(nil) + // ContractCodeEntry is an XDR Struct defines as: // // struct ContractCodeEntry { -// ExtensionPoint ext; +// union switch (int v) +// { +// case 0: +// void; +// case 1: +// struct +// { +// ExtensionPoint ext; +// ContractCodeCostInputs costInputs; +// } v1; +// } ext; // // Hash hash; // opaque code<>; // }; type ContractCodeEntry struct { - Ext ExtensionPoint + Ext ContractCodeEntryExt Hash Hash Code []byte } @@ -8091,7 +8496,7 @@ func (s *ContractCodeEntry) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, erro nTmp, err = s.Ext.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding ExtensionPoint: %w", err) + return n, fmt.Errorf("decoding ContractCodeEntryExt: %w", err) } nTmp, err = s.Hash.DecodeFrom(d, maxDepth) n += nTmp @@ -16349,11 +16754,284 @@ func (s DiagnosticEvent) xdrType() {} var _ xdrType = (*DiagnosticEvent)(nil) +// SorobanTransactionMetaExtV1 is an XDR Struct defines as: +// +// struct SorobanTransactionMetaExtV1 +// { +// ExtensionPoint ext; +// +// // The following are the components of the overall Soroban resource fee +// // charged for the transaction. +// // The following relation holds: +// // `resourceFeeCharged = totalNonRefundableResourceFeeCharged + totalRefundableResourceFeeCharged` +// // where `resourceFeeCharged` is the overall fee charged for the +// // transaction. Also, `resourceFeeCharged` <= `sorobanData.resourceFee` +// // i.e.we never charge more than the declared resource fee. +// // The inclusion fee for charged the Soroban transaction can be found using +// // the following equation: +// // `result.feeCharged = resourceFeeCharged + inclusionFeeCharged`. +// +// // Total amount (in stroops) that has been charged for non-refundable +// // Soroban resources. +// // Non-refundable resources are charged based on the usage declared in +// // the transaction envelope (such as `instructions`, `readBytes` etc.) and +// // is charged regardless of the success of the transaction. +// int64 totalNonRefundableResourceFeeCharged; +// // Total amount (in stroops) that has been charged for refundable +// // Soroban resource fees. +// // Currently this comprises the rent fee (`rentFeeCharged`) and the +// // fee for the events and return value. +// // Refundable resources are charged based on the actual resources usage. +// // Since currently refundable resources are only used for the successful +// // transactions, this will be `0` for failed transactions. +// int64 totalRefundableResourceFeeCharged; +// // Amount (in stroops) that has been charged for rent. +// // This is a part of `totalNonRefundableResourceFeeCharged`. +// int64 rentFeeCharged; +// }; +type SorobanTransactionMetaExtV1 struct { + Ext ExtensionPoint + TotalNonRefundableResourceFeeCharged Int64 + TotalRefundableResourceFeeCharged Int64 + RentFeeCharged Int64 +} + +// EncodeTo encodes this value using the Encoder. +func (s *SorobanTransactionMetaExtV1) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.Ext.EncodeTo(e); err != nil { + return err + } + if err = s.TotalNonRefundableResourceFeeCharged.EncodeTo(e); err != nil { + return err + } + if err = s.TotalRefundableResourceFeeCharged.EncodeTo(e); err != nil { + return err + } + if err = s.RentFeeCharged.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*SorobanTransactionMetaExtV1)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *SorobanTransactionMetaExtV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding SorobanTransactionMetaExtV1: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.Ext.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ExtensionPoint: %w", err) + } + nTmp, err = s.TotalNonRefundableResourceFeeCharged.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Int64: %w", err) + } + nTmp, err = s.TotalRefundableResourceFeeCharged.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Int64: %w", err) + } + nTmp, err = s.RentFeeCharged.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Int64: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s SorobanTransactionMetaExtV1) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *SorobanTransactionMetaExtV1) 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 = (*SorobanTransactionMetaExtV1)(nil) + _ encoding.BinaryUnmarshaler = (*SorobanTransactionMetaExtV1)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s SorobanTransactionMetaExtV1) xdrType() {} + +var _ xdrType = (*SorobanTransactionMetaExtV1)(nil) + +// SorobanTransactionMetaExt is an XDR Union defines as: +// +// union SorobanTransactionMetaExt switch (int v) +// { +// case 0: +// void; +// case 1: +// SorobanTransactionMetaExtV1 v1; +// }; +type SorobanTransactionMetaExt struct { + V int32 + V1 *SorobanTransactionMetaExtV1 +} + +// SwitchFieldName returns the field name in which this union's +// discriminant is stored +func (u SorobanTransactionMetaExt) SwitchFieldName() string { + return "V" +} + +// ArmForSwitch returns which field name should be used for storing +// the value for an instance of SorobanTransactionMetaExt +func (u SorobanTransactionMetaExt) ArmForSwitch(sw int32) (string, bool) { + switch int32(sw) { + case 0: + return "", true + case 1: + return "V1", true + } + return "-", false +} + +// NewSorobanTransactionMetaExt creates a new SorobanTransactionMetaExt. +func NewSorobanTransactionMetaExt(v int32, value interface{}) (result SorobanTransactionMetaExt, err error) { + result.V = v + switch int32(v) { + case 0: + // void + case 1: + tv, ok := value.(SorobanTransactionMetaExtV1) + if !ok { + err = errors.New("invalid value, must be SorobanTransactionMetaExtV1") + return + } + result.V1 = &tv + } + return +} + +// MustV1 retrieves the V1 value from the union, +// panicing if the value is not set. +func (u SorobanTransactionMetaExt) MustV1() SorobanTransactionMetaExtV1 { + val, ok := u.GetV1() + + if !ok { + panic("arm V1 is not set") + } + + return val +} + +// GetV1 retrieves the V1 value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u SorobanTransactionMetaExt) GetV1() (result SorobanTransactionMetaExtV1, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.V)) + + if armName == "V1" { + result = *u.V1 + ok = true + } + + return +} + +// EncodeTo encodes this value using the Encoder. +func (u SorobanTransactionMetaExt) EncodeTo(e *xdr.Encoder) error { + var err error + if _, err = e.EncodeInt(int32(u.V)); err != nil { + return err + } + switch int32(u.V) { + case 0: + // Void + return nil + case 1: + if err = (*u.V1).EncodeTo(e); err != nil { + return err + } + return nil + } + return fmt.Errorf("V (int32) switch value '%d' is not valid for union SorobanTransactionMetaExt", u.V) +} + +var _ decoderFrom = (*SorobanTransactionMetaExt)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (u *SorobanTransactionMetaExt) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding SorobanTransactionMetaExt: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + u.V, nTmp, err = d.DecodeInt() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Int: %w", err) + } + switch int32(u.V) { + case 0: + // Void + return n, nil + case 1: + u.V1 = new(SorobanTransactionMetaExtV1) + nTmp, err = (*u.V1).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding SorobanTransactionMetaExtV1: %w", err) + } + return n, nil + } + return n, fmt.Errorf("union SorobanTransactionMetaExt has invalid V (int32) switch value '%d'", u.V) +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s SorobanTransactionMetaExt) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *SorobanTransactionMetaExt) 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 = (*SorobanTransactionMetaExt)(nil) + _ encoding.BinaryUnmarshaler = (*SorobanTransactionMetaExt)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s SorobanTransactionMetaExt) xdrType() {} + +var _ xdrType = (*SorobanTransactionMetaExt)(nil) + // SorobanTransactionMeta is an XDR Struct defines as: // // struct SorobanTransactionMeta // { -// ExtensionPoint ext; +// SorobanTransactionMetaExt ext; // // ContractEvent events<>; // custom events populated by the // // contracts themselves. @@ -16365,7 +17043,7 @@ var _ xdrType = (*DiagnosticEvent)(nil) // DiagnosticEvent diagnosticEvents<>; // }; type SorobanTransactionMeta struct { - Ext ExtensionPoint + Ext SorobanTransactionMetaExt Events []ContractEvent ReturnValue ScVal DiagnosticEvents []DiagnosticEvent @@ -16412,7 +17090,7 @@ func (s *SorobanTransactionMeta) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, nTmp, err = s.Ext.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding ExtensionPoint: %w", err) + return n, fmt.Errorf("decoding SorobanTransactionMetaExt: %w", err) } var l uint32 l, nTmp, err = d.DecodeUint() @@ -17370,13 +18048,238 @@ func (s LedgerCloseMetaV0) xdrType() {} var _ xdrType = (*LedgerCloseMetaV0)(nil) +// LedgerCloseMetaExtV1 is an XDR Struct defines as: +// +// struct LedgerCloseMetaExtV1 +// { +// ExtensionPoint ext; +// int64 sorobanFeeWrite1KB; +// }; +type LedgerCloseMetaExtV1 struct { + Ext ExtensionPoint + SorobanFeeWrite1Kb Int64 +} + +// EncodeTo encodes this value using the Encoder. +func (s *LedgerCloseMetaExtV1) EncodeTo(e *xdr.Encoder) error { + var err error + if err = s.Ext.EncodeTo(e); err != nil { + return err + } + if err = s.SorobanFeeWrite1Kb.EncodeTo(e); err != nil { + return err + } + return nil +} + +var _ decoderFrom = (*LedgerCloseMetaExtV1)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (s *LedgerCloseMetaExtV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding LedgerCloseMetaExtV1: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + nTmp, err = s.Ext.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding ExtensionPoint: %w", err) + } + nTmp, err = s.SorobanFeeWrite1Kb.DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Int64: %w", err) + } + return n, nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s LedgerCloseMetaExtV1) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *LedgerCloseMetaExtV1) 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 = (*LedgerCloseMetaExtV1)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerCloseMetaExtV1)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s LedgerCloseMetaExtV1) xdrType() {} + +var _ xdrType = (*LedgerCloseMetaExtV1)(nil) + +// LedgerCloseMetaExt is an XDR Union defines as: +// +// union LedgerCloseMetaExt switch (int v) +// { +// case 0: +// void; +// case 1: +// LedgerCloseMetaExtV1 v1; +// }; +type LedgerCloseMetaExt struct { + V int32 + V1 *LedgerCloseMetaExtV1 +} + +// SwitchFieldName returns the field name in which this union's +// discriminant is stored +func (u LedgerCloseMetaExt) SwitchFieldName() string { + return "V" +} + +// ArmForSwitch returns which field name should be used for storing +// the value for an instance of LedgerCloseMetaExt +func (u LedgerCloseMetaExt) ArmForSwitch(sw int32) (string, bool) { + switch int32(sw) { + case 0: + return "", true + case 1: + return "V1", true + } + return "-", false +} + +// NewLedgerCloseMetaExt creates a new LedgerCloseMetaExt. +func NewLedgerCloseMetaExt(v int32, value interface{}) (result LedgerCloseMetaExt, err error) { + result.V = v + switch int32(v) { + case 0: + // void + case 1: + tv, ok := value.(LedgerCloseMetaExtV1) + if !ok { + err = errors.New("invalid value, must be LedgerCloseMetaExtV1") + return + } + result.V1 = &tv + } + return +} + +// MustV1 retrieves the V1 value from the union, +// panicing if the value is not set. +func (u LedgerCloseMetaExt) MustV1() LedgerCloseMetaExtV1 { + val, ok := u.GetV1() + + if !ok { + panic("arm V1 is not set") + } + + return val +} + +// GetV1 retrieves the V1 value from the union, +// returning ok if the union's switch indicated the value is valid. +func (u LedgerCloseMetaExt) GetV1() (result LedgerCloseMetaExtV1, ok bool) { + armName, _ := u.ArmForSwitch(int32(u.V)) + + if armName == "V1" { + result = *u.V1 + ok = true + } + + return +} + +// EncodeTo encodes this value using the Encoder. +func (u LedgerCloseMetaExt) EncodeTo(e *xdr.Encoder) error { + var err error + if _, err = e.EncodeInt(int32(u.V)); err != nil { + return err + } + switch int32(u.V) { + case 0: + // Void + return nil + case 1: + if err = (*u.V1).EncodeTo(e); err != nil { + return err + } + return nil + } + return fmt.Errorf("V (int32) switch value '%d' is not valid for union LedgerCloseMetaExt", u.V) +} + +var _ decoderFrom = (*LedgerCloseMetaExt)(nil) + +// DecodeFrom decodes this value using the Decoder. +func (u *LedgerCloseMetaExt) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, error) { + if maxDepth == 0 { + return 0, fmt.Errorf("decoding LedgerCloseMetaExt: %w", ErrMaxDecodingDepthReached) + } + maxDepth -= 1 + var err error + var n, nTmp int + u.V, nTmp, err = d.DecodeInt() + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding Int: %w", err) + } + switch int32(u.V) { + case 0: + // Void + return n, nil + case 1: + u.V1 = new(LedgerCloseMetaExtV1) + nTmp, err = (*u.V1).DecodeFrom(d, maxDepth) + n += nTmp + if err != nil { + return n, fmt.Errorf("decoding LedgerCloseMetaExtV1: %w", err) + } + return n, nil + } + return n, fmt.Errorf("union LedgerCloseMetaExt has invalid V (int32) switch value '%d'", u.V) +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (s LedgerCloseMetaExt) MarshalBinary() ([]byte, error) { + b := bytes.Buffer{} + e := xdr.NewEncoder(&b) + err := s.EncodeTo(e) + return b.Bytes(), err +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (s *LedgerCloseMetaExt) 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 = (*LedgerCloseMetaExt)(nil) + _ encoding.BinaryUnmarshaler = (*LedgerCloseMetaExt)(nil) +) + +// xdrType signals that this type represents XDR values defined by this package. +func (s LedgerCloseMetaExt) xdrType() {} + +var _ xdrType = (*LedgerCloseMetaExt)(nil) + // LedgerCloseMetaV1 is an XDR Struct defines as: // // struct LedgerCloseMetaV1 // { -// // We forgot to add an ExtensionPoint in v0 but at least -// // we can add one now in v1. -// ExtensionPoint ext; +// LedgerCloseMetaExt ext; // // LedgerHeaderHistoryEntry ledgerHeader; // @@ -17405,7 +18308,7 @@ var _ xdrType = (*LedgerCloseMetaV0)(nil) // LedgerEntry evictedPersistentLedgerEntries<>; // }; type LedgerCloseMetaV1 struct { - Ext ExtensionPoint + Ext LedgerCloseMetaExt LedgerHeader LedgerHeaderHistoryEntry TxSet GeneralizedTransactionSet TxProcessing []TransactionResultMeta @@ -17487,7 +18390,7 @@ func (s *LedgerCloseMetaV1) DecodeFrom(d *xdr.Decoder, maxDepth uint) (int, erro nTmp, err = s.Ext.DecodeFrom(d, maxDepth) n += nTmp if err != nil { - return n, fmt.Errorf("decoding ExtensionPoint: %w", err) + return n, fmt.Errorf("decoding LedgerCloseMetaExt: %w", err) } nTmp, err = s.LedgerHeader.DecodeFrom(d, maxDepth) n += nTmp @@ -55059,8 +55962,9 @@ var _ xdrType = (*ConfigSettingContractBandwidthV0)(nil) // InvokeVmFunction = 13, // // Cost of computing a keccak256 hash from bytes. // ComputeKeccak256Hash = 14, -// // Cost of computing an ECDSA secp256k1 signature from bytes. -// ComputeEcdsaSecp256k1Sig = 15, +// // Cost of decoding an ECDSA signature computed from a 256-bit prime modulus +// // curve (e.g. secp256k1 and secp256r1) +// DecodeEcdsaCurve256Sig = 15, // // Cost of recovering an ECDSA secp256k1 key from a signature. // RecoverEcdsaSecp256k1Key = 16, // // Cost of int256 addition (`+`) and subtraction (`-`) operations @@ -55074,34 +55978,104 @@ var _ xdrType = (*ConfigSettingContractBandwidthV0)(nil) // // Cost of int256 shift (`shl`, `shr`) operation // Int256Shift = 21, // // Cost of drawing random bytes using a ChaCha20 PRNG -// ChaCha20DrawBytes = 22 +// ChaCha20DrawBytes = 22, +// +// // Cost of parsing wasm bytes that only encode instructions. +// ParseWasmInstructions = 23, +// // Cost of parsing a known number of wasm functions. +// ParseWasmFunctions = 24, +// // Cost of parsing a known number of wasm globals. +// ParseWasmGlobals = 25, +// // Cost of parsing a known number of wasm table entries. +// ParseWasmTableEntries = 26, +// // Cost of parsing a known number of wasm types. +// ParseWasmTypes = 27, +// // Cost of parsing a known number of wasm data segments. +// ParseWasmDataSegments = 28, +// // Cost of parsing a known number of wasm element segments. +// ParseWasmElemSegments = 29, +// // Cost of parsing a known number of wasm imports. +// ParseWasmImports = 30, +// // Cost of parsing a known number of wasm exports. +// ParseWasmExports = 31, +// // Cost of parsing a known number of data segment bytes. +// ParseWasmDataSegmentBytes = 32, +// +// // Cost of instantiating wasm bytes that only encode instructions. +// InstantiateWasmInstructions = 33, +// // Cost of instantiating a known number of wasm functions. +// InstantiateWasmFunctions = 34, +// // Cost of instantiating a known number of wasm globals. +// InstantiateWasmGlobals = 35, +// // Cost of instantiating a known number of wasm table entries. +// InstantiateWasmTableEntries = 36, +// // Cost of instantiating a known number of wasm types. +// InstantiateWasmTypes = 37, +// // Cost of instantiating a known number of wasm data segments. +// InstantiateWasmDataSegments = 38, +// // Cost of instantiating a known number of wasm element segments. +// InstantiateWasmElemSegments = 39, +// // Cost of instantiating a known number of wasm imports. +// InstantiateWasmImports = 40, +// // Cost of instantiating a known number of wasm exports. +// InstantiateWasmExports = 41, +// // Cost of instantiating a known number of data segment bytes. +// InstantiateWasmDataSegmentBytes = 42, +// +// // Cost of decoding a bytes array representing an uncompressed SEC-1 encoded +// // point on a 256-bit elliptic curve +// Sec1DecodePointUncompressed = 43, +// // Cost of verifying an ECDSA Secp256r1 signature +// VerifyEcdsaSecp256r1Sig = 44 // }; type ContractCostType int32 const ( - ContractCostTypeWasmInsnExec ContractCostType = 0 - ContractCostTypeMemAlloc ContractCostType = 1 - ContractCostTypeMemCpy ContractCostType = 2 - ContractCostTypeMemCmp ContractCostType = 3 - ContractCostTypeDispatchHostFunction ContractCostType = 4 - ContractCostTypeVisitObject ContractCostType = 5 - ContractCostTypeValSer ContractCostType = 6 - ContractCostTypeValDeser ContractCostType = 7 - ContractCostTypeComputeSha256Hash ContractCostType = 8 - ContractCostTypeComputeEd25519PubKey ContractCostType = 9 - ContractCostTypeVerifyEd25519Sig ContractCostType = 10 - ContractCostTypeVmInstantiation ContractCostType = 11 - ContractCostTypeVmCachedInstantiation ContractCostType = 12 - ContractCostTypeInvokeVmFunction ContractCostType = 13 - ContractCostTypeComputeKeccak256Hash ContractCostType = 14 - ContractCostTypeComputeEcdsaSecp256k1Sig ContractCostType = 15 - ContractCostTypeRecoverEcdsaSecp256k1Key ContractCostType = 16 - ContractCostTypeInt256AddSub ContractCostType = 17 - ContractCostTypeInt256Mul ContractCostType = 18 - ContractCostTypeInt256Div ContractCostType = 19 - ContractCostTypeInt256Pow ContractCostType = 20 - ContractCostTypeInt256Shift ContractCostType = 21 - ContractCostTypeChaCha20DrawBytes ContractCostType = 22 + ContractCostTypeWasmInsnExec ContractCostType = 0 + ContractCostTypeMemAlloc ContractCostType = 1 + ContractCostTypeMemCpy ContractCostType = 2 + ContractCostTypeMemCmp ContractCostType = 3 + ContractCostTypeDispatchHostFunction ContractCostType = 4 + ContractCostTypeVisitObject ContractCostType = 5 + ContractCostTypeValSer ContractCostType = 6 + ContractCostTypeValDeser ContractCostType = 7 + ContractCostTypeComputeSha256Hash ContractCostType = 8 + ContractCostTypeComputeEd25519PubKey ContractCostType = 9 + ContractCostTypeVerifyEd25519Sig ContractCostType = 10 + ContractCostTypeVmInstantiation ContractCostType = 11 + ContractCostTypeVmCachedInstantiation ContractCostType = 12 + ContractCostTypeInvokeVmFunction ContractCostType = 13 + ContractCostTypeComputeKeccak256Hash ContractCostType = 14 + ContractCostTypeDecodeEcdsaCurve256Sig ContractCostType = 15 + ContractCostTypeRecoverEcdsaSecp256k1Key ContractCostType = 16 + ContractCostTypeInt256AddSub ContractCostType = 17 + ContractCostTypeInt256Mul ContractCostType = 18 + ContractCostTypeInt256Div ContractCostType = 19 + ContractCostTypeInt256Pow ContractCostType = 20 + ContractCostTypeInt256Shift ContractCostType = 21 + ContractCostTypeChaCha20DrawBytes ContractCostType = 22 + ContractCostTypeParseWasmInstructions ContractCostType = 23 + ContractCostTypeParseWasmFunctions ContractCostType = 24 + ContractCostTypeParseWasmGlobals ContractCostType = 25 + ContractCostTypeParseWasmTableEntries ContractCostType = 26 + ContractCostTypeParseWasmTypes ContractCostType = 27 + ContractCostTypeParseWasmDataSegments ContractCostType = 28 + ContractCostTypeParseWasmElemSegments ContractCostType = 29 + ContractCostTypeParseWasmImports ContractCostType = 30 + ContractCostTypeParseWasmExports ContractCostType = 31 + ContractCostTypeParseWasmDataSegmentBytes ContractCostType = 32 + ContractCostTypeInstantiateWasmInstructions ContractCostType = 33 + ContractCostTypeInstantiateWasmFunctions ContractCostType = 34 + ContractCostTypeInstantiateWasmGlobals ContractCostType = 35 + ContractCostTypeInstantiateWasmTableEntries ContractCostType = 36 + ContractCostTypeInstantiateWasmTypes ContractCostType = 37 + ContractCostTypeInstantiateWasmDataSegments ContractCostType = 38 + ContractCostTypeInstantiateWasmElemSegments ContractCostType = 39 + ContractCostTypeInstantiateWasmImports ContractCostType = 40 + ContractCostTypeInstantiateWasmExports ContractCostType = 41 + ContractCostTypeInstantiateWasmDataSegmentBytes ContractCostType = 42 + ContractCostTypeSec1DecodePointUncompressed ContractCostType = 43 + ContractCostTypeVerifyEcdsaSecp256r1Sig ContractCostType = 44 ) var contractCostTypeMap = map[int32]string{ @@ -55120,7 +56094,7 @@ var contractCostTypeMap = map[int32]string{ 12: "ContractCostTypeVmCachedInstantiation", 13: "ContractCostTypeInvokeVmFunction", 14: "ContractCostTypeComputeKeccak256Hash", - 15: "ContractCostTypeComputeEcdsaSecp256k1Sig", + 15: "ContractCostTypeDecodeEcdsaCurve256Sig", 16: "ContractCostTypeRecoverEcdsaSecp256k1Key", 17: "ContractCostTypeInt256AddSub", 18: "ContractCostTypeInt256Mul", @@ -55128,6 +56102,28 @@ var contractCostTypeMap = map[int32]string{ 20: "ContractCostTypeInt256Pow", 21: "ContractCostTypeInt256Shift", 22: "ContractCostTypeChaCha20DrawBytes", + 23: "ContractCostTypeParseWasmInstructions", + 24: "ContractCostTypeParseWasmFunctions", + 25: "ContractCostTypeParseWasmGlobals", + 26: "ContractCostTypeParseWasmTableEntries", + 27: "ContractCostTypeParseWasmTypes", + 28: "ContractCostTypeParseWasmDataSegments", + 29: "ContractCostTypeParseWasmElemSegments", + 30: "ContractCostTypeParseWasmImports", + 31: "ContractCostTypeParseWasmExports", + 32: "ContractCostTypeParseWasmDataSegmentBytes", + 33: "ContractCostTypeInstantiateWasmInstructions", + 34: "ContractCostTypeInstantiateWasmFunctions", + 35: "ContractCostTypeInstantiateWasmGlobals", + 36: "ContractCostTypeInstantiateWasmTableEntries", + 37: "ContractCostTypeInstantiateWasmTypes", + 38: "ContractCostTypeInstantiateWasmDataSegments", + 39: "ContractCostTypeInstantiateWasmElemSegments", + 40: "ContractCostTypeInstantiateWasmImports", + 41: "ContractCostTypeInstantiateWasmExports", + 42: "ContractCostTypeInstantiateWasmDataSegmentBytes", + 43: "ContractCostTypeSec1DecodePointUncompressed", + 44: "ContractCostTypeVerifyEcdsaSecp256r1Sig", } // ValidEnum validates a proposed value for this enum. Implements