From 2c748885f2445b1a8e51869af2ecd13705458dcf Mon Sep 17 00:00:00 2001 From: George Date: Fri, 19 Jul 2024 13:47:11 -0700 Subject: [PATCH 01/19] Use `TransactionInfo` within `GetTransactionResponse` (#251) * Encode createdAt as a string for JS support --- .../internal/methods/get_transaction.go | 24 +----- .../internal/methods/get_transaction_test.go | 86 +++++++++++-------- .../internal/methods/get_transactions.go | 2 +- 3 files changed, 51 insertions(+), 61 deletions(-) diff --git a/cmd/soroban-rpc/internal/methods/get_transaction.go b/cmd/soroban-rpc/internal/methods/get_transaction.go index ac6ac8b2..7c6cef4d 100644 --- a/cmd/soroban-rpc/internal/methods/get_transaction.go +++ b/cmd/soroban-rpc/internal/methods/get_transaction.go @@ -29,8 +29,6 @@ const ( // GetTransactionResponse is the response for the Soroban-RPC getTransaction() endpoint type GetTransactionResponse struct { - // Status is one of: TransactionSuccess, TransactionNotFound, or TransactionFailed. - Status string `json:"status"` // LatestLedger is the latest ledger stored in Soroban-RPC. LatestLedger uint32 `json:"latestLedger"` // LatestLedgerCloseTime is the unix timestamp of when the latest ledger was closed. @@ -41,27 +39,7 @@ type GetTransactionResponse struct { OldestLedgerCloseTime int64 `json:"oldestLedgerCloseTime,string"` // The fields below are only present if Status is not TransactionNotFound. - - // ApplicationOrder is the index of the transaction among all the transactions - // for that ledger. - ApplicationOrder int32 `json:"applicationOrder,omitempty"` - // FeeBump indicates whether the transaction is a feebump transaction - FeeBump bool `json:"feeBump,omitempty"` - // EnvelopeXdr is the TransactionEnvelope XDR value. - EnvelopeXdr string `json:"envelopeXdr,omitempty"` - // ResultXdr is the TransactionResult XDR value. - ResultXdr string `json:"resultXdr,omitempty"` - // ResultMetaXdr is the TransactionMeta XDR value. - ResultMetaXdr string `json:"resultMetaXdr,omitempty"` - - // Ledger is the sequence of the ledger which included the transaction. - Ledger uint32 `json:"ledger,omitempty"` - // LedgerCloseTime is the unix timestamp of when the transaction was included in the ledger. - LedgerCloseTime int64 `json:"createdAt,string,omitempty"` - - // DiagnosticEventsXDR is present only if Status is equal to TransactionFailed. - // DiagnosticEventsXDR is a base64-encoded slice of xdr.DiagnosticEvent - DiagnosticEventsXDR []string `json:"diagnosticEventsXdr,omitempty"` + TransactionInfo } type GetTransactionRequest struct { diff --git a/cmd/soroban-rpc/internal/methods/get_transaction_test.go b/cmd/soroban-rpc/internal/methods/get_transaction_test.go index 1bc6f2b9..66089ddc 100644 --- a/cmd/soroban-rpc/internal/methods/get_transaction_test.go +++ b/cmd/soroban-rpc/internal/methods/get_transaction_test.go @@ -33,7 +33,11 @@ func TestGetTransaction(t *testing.T) { hash := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" tx, err := GetTransaction(ctx, log, store, ledgerReader, GetTransactionRequest{hash}) require.NoError(t, err) - require.Equal(t, GetTransactionResponse{Status: TransactionStatusNotFound}, tx) + require.Equal(t, GetTransactionResponse{ + TransactionInfo: TransactionInfo{ + Status: TransactionStatusNotFound, + }, + }, tx) meta := txMeta(1, true) require.NoError(t, store.InsertTransactions(meta)) @@ -50,19 +54,21 @@ func TestGetTransaction(t *testing.T) { expectedTxMeta, err := xdr.MarshalBase64(meta.V1.TxProcessing[0].TxApplyProcessing) require.NoError(t, err) require.Equal(t, GetTransactionResponse{ - Status: TransactionStatusSuccess, LatestLedger: 101, LatestLedgerCloseTime: 2625, OldestLedger: 101, OldestLedgerCloseTime: 2625, - ApplicationOrder: 1, - FeeBump: false, - EnvelopeXdr: expectedEnvelope, - ResultXdr: expectedTxResult, - ResultMetaXdr: expectedTxMeta, - Ledger: 101, - LedgerCloseTime: 2625, - DiagnosticEventsXDR: []string{}, + TransactionInfo: TransactionInfo{ + Status: TransactionStatusSuccess, + ApplicationOrder: 1, + FeeBump: false, + EnvelopeXdr: expectedEnvelope, + ResultXdr: expectedTxResult, + ResultMetaXdr: expectedTxMeta, + Ledger: 101, + LedgerCloseTime: 2625, + DiagnosticEventsXDR: []string{}, + }, }, tx) // ingest another (failed) transaction @@ -73,19 +79,21 @@ func TestGetTransaction(t *testing.T) { tx, err = GetTransaction(ctx, log, store, ledgerReader, GetTransactionRequest{hash}) require.NoError(t, err) require.Equal(t, GetTransactionResponse{ - Status: TransactionStatusSuccess, LatestLedger: 102, LatestLedgerCloseTime: 2650, OldestLedger: 101, OldestLedgerCloseTime: 2625, - ApplicationOrder: 1, - FeeBump: false, - EnvelopeXdr: expectedEnvelope, - ResultXdr: expectedTxResult, - ResultMetaXdr: expectedTxMeta, - Ledger: 101, - LedgerCloseTime: 2625, - DiagnosticEventsXDR: []string{}, + TransactionInfo: TransactionInfo{ + Status: TransactionStatusSuccess, + ApplicationOrder: 1, + FeeBump: false, + EnvelopeXdr: expectedEnvelope, + ResultXdr: expectedTxResult, + ResultMetaXdr: expectedTxMeta, + Ledger: 101, + LedgerCloseTime: 2625, + DiagnosticEventsXDR: []string{}, + }, }, tx) // the new transaction should also be there @@ -102,19 +110,21 @@ func TestGetTransaction(t *testing.T) { tx, err = GetTransaction(ctx, log, store, ledgerReader, GetTransactionRequest{hash}) require.NoError(t, err) require.Equal(t, GetTransactionResponse{ - Status: TransactionStatusFailed, LatestLedger: 102, LatestLedgerCloseTime: 2650, OldestLedger: 101, OldestLedgerCloseTime: 2625, - ApplicationOrder: 1, - FeeBump: false, - EnvelopeXdr: expectedEnvelope, - ResultXdr: expectedTxResult, - ResultMetaXdr: expectedTxMeta, - Ledger: 102, - LedgerCloseTime: 2650, - DiagnosticEventsXDR: []string{}, + TransactionInfo: TransactionInfo{ + Status: TransactionStatusFailed, + ApplicationOrder: 1, + FeeBump: false, + EnvelopeXdr: expectedEnvelope, + ResultXdr: expectedTxResult, + ResultMetaXdr: expectedTxMeta, + Ledger: 102, + LedgerCloseTime: 2650, + DiagnosticEventsXDR: []string{}, + }, }, tx) // Test Txn with events @@ -139,19 +149,21 @@ func TestGetTransaction(t *testing.T) { tx, err = GetTransaction(ctx, log, store, ledgerReader, GetTransactionRequest{hash}) require.NoError(t, err) require.Equal(t, GetTransactionResponse{ - Status: TransactionStatusSuccess, + TransactionInfo: TransactionInfo{ + Status: TransactionStatusSuccess, + ApplicationOrder: 1, + FeeBump: false, + EnvelopeXdr: expectedEnvelope, + ResultXdr: expectedTxResult, + ResultMetaXdr: expectedTxMeta, + Ledger: 103, + LedgerCloseTime: 2675, + DiagnosticEventsXDR: []string{expectedEventsMeta}, + }, LatestLedger: 103, LatestLedgerCloseTime: 2675, OldestLedger: 101, OldestLedgerCloseTime: 2625, - ApplicationOrder: 1, - FeeBump: false, - EnvelopeXdr: expectedEnvelope, - ResultXdr: expectedTxResult, - ResultMetaXdr: expectedTxMeta, - Ledger: 103, - LedgerCloseTime: 2675, - DiagnosticEventsXDR: []string{expectedEventsMeta}, }, tx) } diff --git a/cmd/soroban-rpc/internal/methods/get_transactions.go b/cmd/soroban-rpc/internal/methods/get_transactions.go index 1d16f259..547b6053 100644 --- a/cmd/soroban-rpc/internal/methods/get_transactions.go +++ b/cmd/soroban-rpc/internal/methods/get_transactions.go @@ -72,7 +72,7 @@ type TransactionInfo struct { // Ledger is the sequence of the ledger which included the transaction. Ledger uint32 `json:"ledger"` // LedgerCloseTime is the unix timestamp of when the transaction was included in the ledger. - LedgerCloseTime int64 `json:"createdAt"` + LedgerCloseTime int64 `json:"createdAt,string"` } // GetTransactionsResponse encapsulates the response structure for getTransactions queries. From 2daf0237c19adce9891f2b71a5055bb316cd1a71 Mon Sep 17 00:00:00 2001 From: overcat <4catcode@gmail.com> Date: Thu, 9 May 2024 15:24:43 +0800 Subject: [PATCH 02/19] Change API field naming style to Camel Case. --- cmd/soroban-rpc/internal/methods/get_version_info.go | 11 +++++------ .../internal/methods/simulate_transaction.go | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cmd/soroban-rpc/internal/methods/get_version_info.go b/cmd/soroban-rpc/internal/methods/get_version_info.go index 2af129de..038bf54a 100644 --- a/cmd/soroban-rpc/internal/methods/get_version_info.go +++ b/cmd/soroban-rpc/internal/methods/get_version_info.go @@ -14,12 +14,11 @@ import ( ) type GetVersionInfoResponse struct { - Version string `json:"version"` - // TODO: casing to be fixed by https://github.com/stellar/soroban-rpc/pull/164 - CommitHash string `json:"commit_hash"` //nolint:tagliatelle - BuildTimestamp string `json:"build_time_stamp"` //nolint:tagliatelle - CaptiveCoreVersion string `json:"captive_core_version"` //nolint:tagliatelle - ProtocolVersion uint32 `json:"protocol_version"` //nolint:tagliatelle + Version string `json:"version"` + CommitHash string `json:"commitHash"` + BuildTimestamp string `json:"buildTimestamp"` + CaptiveCoreVersion string `json:"captiveCoreVersion"` + ProtocolVersion uint32 `json:"protocolVersion"` } func NewGetVersionInfoHandler( diff --git a/cmd/soroban-rpc/internal/methods/simulate_transaction.go b/cmd/soroban-rpc/internal/methods/simulate_transaction.go index 2a26b08a..1e945b01 100644 --- a/cmd/soroban-rpc/internal/methods/simulate_transaction.go +++ b/cmd/soroban-rpc/internal/methods/simulate_transaction.go @@ -190,7 +190,7 @@ func (l *LedgerEntryChange) jsonXdrDiff(diff preflight.XDRDiff, key xdr.LedgerKe } // LedgerEntryChange designates a change in a ledger entry. Before and After cannot be omitted at the same time. -// If Before is omitted, it constitutes a creation, if After is omitted, it constitutes a delation. +// If Before is omitted, it constitutes a creation, if After is omitted, it constitutes a deletion. type LedgerEntryChange struct { Type LedgerEntryChangeType `json:"type"` From 4bd23cb7bbf8be8d5593f684ae409d1323bdfec3 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Fri, 30 Aug 2024 02:47:48 +0200 Subject: [PATCH 03/19] itests: use `docker compose` if `docker-compose` is unavailable (#279) --- .../internal/integrationtest/infrastructure/test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/soroban-rpc/internal/integrationtest/infrastructure/test.go b/cmd/soroban-rpc/internal/integrationtest/infrastructure/test.go index 25e0fa4b..0a7b91ee 100644 --- a/cmd/soroban-rpc/internal/integrationtest/infrastructure/test.go +++ b/cmd/soroban-rpc/internal/integrationtest/infrastructure/test.go @@ -468,6 +468,11 @@ func (i *Test) getComposeCommand(args ...string) *exec.Cmd { cmdline = append([]string{"-p", projectName}, cmdline...) cmdline = append(cmdline, args...) cmd := exec.Command("docker-compose", cmdline...) + _, err := exec.LookPath("docker-compose") + if err != nil { + cmdline = append([]string{"compose"}, cmdline...) + cmd = exec.Command("docker", cmdline...) + } if img := os.Getenv("SOROBAN_RPC_INTEGRATION_TESTS_DOCKER_IMG"); img != "" { cmd.Env = append( From 60ebdaffc64b7673fdb3b4fcbbd94777dce3f3e0 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Tue, 13 Aug 2024 14:24:31 -0700 Subject: [PATCH 04/19] Cut xdr2json dependency on soroban host. --- cmd/soroban-rpc/lib/xdr2json/Cargo.toml | 3 +-- cmd/soroban-rpc/lib/xdr2json/src/lib.rs | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/cmd/soroban-rpc/lib/xdr2json/Cargo.toml b/cmd/soroban-rpc/lib/xdr2json/Cargo.toml index e0119838..8288d2fb 100644 --- a/cmd/soroban-rpc/lib/xdr2json/Cargo.toml +++ b/cmd/soroban-rpc/lib/xdr2json/Cargo.toml @@ -15,5 +15,4 @@ anyhow = { workspace = true } serde_json = { workspace = true } rand = { workspace = true } -stellar-xdr = { workspace = true } -soroban-env-host = { workspace = true, features = ["unstable-next-api"]} \ No newline at end of file +stellar-xdr = { workspace = true } \ No newline at end of file diff --git a/cmd/soroban-rpc/lib/xdr2json/src/lib.rs b/cmd/soroban-rpc/lib/xdr2json/src/lib.rs index e1f524be..c9c151e1 100644 --- a/cmd/soroban-rpc/lib/xdr2json/src/lib.rs +++ b/cmd/soroban-rpc/lib/xdr2json/src/lib.rs @@ -1,16 +1,30 @@ extern crate anyhow; extern crate ffi; -extern crate soroban_env_host; extern crate stellar_xdr; use std::{panic, str::FromStr}; +use stellar_xdr::curr as xdr; use anyhow::Result; // We really do need everything. #[allow(clippy::wildcard_imports)] use ffi::*; -use soroban_env_host::{xdr, DEFAULT_XDR_RW_LIMITS}; + +// This is the same limit as the soroban serialization limit +// but we redefine it here for two reasons: +// +// 1. To depend only on the XDR crate, not the soroban host. +// 2. To allow customizing it here, since this function may +// serialize many XDR types that are larger than the types +// soroban allows serializing (eg. transaction sets or ledger +// entries or whatever). Soroban is conservative and stops +// at 32MiB. + +const DEFAULT_XDR_RW_LIMITS: xdr::Limits = xdr::Limits { + depth: 500, + len: 32 * 1024 * 1024, +}; #[repr(C)] pub struct ConversionResult { From 2408ad583f4b9ebcb5295407de6a2629d61c53b7 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Tue, 13 Aug 2024 14:26:41 -0700 Subject: [PATCH 05/19] Support two soroban host versions in preflight, switched by protocol. --- Cargo.lock | 230 +++++++++-- Cargo.toml | 23 +- cmd/soroban-rpc/lib/preflight/Cargo.toml | 6 +- cmd/soroban-rpc/lib/preflight/src/lib.rs | 425 ++++---------------- cmd/soroban-rpc/lib/preflight/src/shared.rs | 379 +++++++++++++++++ 5 files changed, 683 insertions(+), 380 deletions(-) create mode 100644 cmd/soroban-rpc/lib/preflight/src/shared.rs diff --git a/Cargo.lock b/Cargo.lock index d90f8a22..699be22f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,18 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "android-tzdata" version = "0.1.1" @@ -47,6 +59,12 @@ dependencies = [ "derive_arbitrary", ] +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + [[package]] name = "autocfg" version = "1.1.0" @@ -467,6 +485,9 @@ name = "hashbrown" version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash", +] [[package]] name = "hex" @@ -627,6 +648,12 @@ dependencies = [ "adler", ] +[[package]] +name = "multi-stash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "685a9ac4b61f4e728e1d2c6a7844609c16527aeb5e6c865915c08e619c16410f" + [[package]] name = "num-conv" version = "0.1.0" @@ -735,8 +762,10 @@ dependencies = [ "rand", "serde_json", "sha2", - "soroban-env-host", - "soroban-simulation", + "soroban-env-host 21.2.0", + "soroban-env-host 22.0.0", + "soroban-simulation 21.2.0", + "soroban-simulation 22.0.0", ] [[package]] @@ -946,9 +975,20 @@ checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "soroban-builtin-sdk-macros" -version = "21.1.0" +version = "21.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084aab008009e712c445a9d7eab837a86559a6c2341f30bc4f33e9b258947688" +checksum = "44877373b3dc6c662377cb1600e3a62706d75e484b6064f9cd22e467c676b159" +dependencies = [ + "itertools", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "soroban-builtin-sdk-macros" +version = "22.0.0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=b01e79899ceeeb3d39f9531bbc09b39bf0149da8#b01e79899ceeeb3d39f9531bbc09b39bf0149da8" dependencies = [ "itertools", "proc-macro2", @@ -958,17 +998,34 @@ dependencies = [ [[package]] name = "soroban-env-common" -version = "21.1.0" +version = "21.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c16ee889fe99d6828bf3ffac00c84382793c31d62682401dbfa3e1b512f0c542" +checksum = "590add16843a61b01844e19e89bccaaee6aa21dc76809017b0662c17dc139ee9" +dependencies = [ + "arbitrary", + "crate-git-revision", + "ethnum", + "num-derive", + "num-traits", + "soroban-env-macros 21.2.0", + "soroban-wasmi 0.31.1-soroban.20.0.1", + "static_assertions", + "stellar-xdr", + "wasmparser", +] + +[[package]] +name = "soroban-env-common" +version = "22.0.0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=b01e79899ceeeb3d39f9531bbc09b39bf0149da8#b01e79899ceeeb3d39f9531bbc09b39bf0149da8" dependencies = [ "arbitrary", "crate-git-revision", "ethnum", "num-derive", "num-traits", - "soroban-env-macros", - "soroban-wasmi", + "soroban-env-macros 22.0.0", + "soroban-wasmi 0.36.0-soroban.22.0.0", "static_assertions", "stellar-xdr", "wasmparser", @@ -976,9 +1033,41 @@ dependencies = [ [[package]] name = "soroban-env-host" -version = "21.1.0" +version = "21.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b73f48ae8081ecfb6c0d56c67f139c52cb6d5b6800d5e1adb9eef8e14a155b9" +checksum = "4e25aaffe0c62eb65e0e349f725b4b8b13ad0764d78a15aab5bbccb5c4797726" +dependencies = [ + "backtrace", + "curve25519-dalek", + "ecdsa", + "ed25519-dalek", + "elliptic-curve", + "generic-array", + "getrandom", + "hex-literal", + "hmac", + "k256", + "num-derive", + "num-integer", + "num-traits", + "p256", + "rand", + "rand_chacha", + "sec1", + "sha2", + "sha3", + "soroban-builtin-sdk-macros 21.2.0", + "soroban-env-common 21.2.0", + "soroban-wasmi 0.31.1-soroban.20.0.1", + "static_assertions", + "stellar-strkey", + "wasmparser", +] + +[[package]] +name = "soroban-env-host" +version = "22.0.0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=b01e79899ceeeb3d39f9531bbc09b39bf0149da8#b01e79899ceeeb3d39f9531bbc09b39bf0149da8" dependencies = [ "backtrace", "curve25519-dalek", @@ -999,9 +1088,9 @@ dependencies = [ "sec1", "sha2", "sha3", - "soroban-builtin-sdk-macros", - "soroban-env-common", - "soroban-wasmi", + "soroban-builtin-sdk-macros 22.0.0", + "soroban-env-common 22.0.0", + "soroban-wasmi 0.36.0-soroban.22.0.0", "static_assertions", "stellar-strkey", "wasmparser", @@ -1009,9 +1098,23 @@ dependencies = [ [[package]] name = "soroban-env-macros" -version = "21.1.0" +version = "21.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06d0581e3aba14892ee0ce63788f3d3e5d9eb1ab18906a9b7c66d77dae9e9fea" +checksum = "3e16b761459fdf3c4b62b24df3941498d14e5246e6fadfb4774ed8114d243aa4" +dependencies = [ + "itertools", + "proc-macro2", + "quote", + "serde", + "serde_json", + "stellar-xdr", + "syn", +] + +[[package]] +name = "soroban-env-macros" +version = "22.0.0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=b01e79899ceeeb3d39f9531bbc09b39bf0149da8#b01e79899ceeeb3d39f9531bbc09b39bf0149da8" dependencies = [ "itertools", "proc-macro2", @@ -1024,13 +1127,25 @@ dependencies = [ [[package]] name = "soroban-simulation" -version = "21.1.0" +version = "21.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1a21415ec408b0632763e7a6302a041701e06b1491dbe14fc0b8a8a1a927980" +checksum = "b5869ccbe217b54b2dfc762db9cb8bf1ae28f056a88e75acdab6e8418df8dcdc" dependencies = [ "anyhow", "rand", - "soroban-env-host", + "soroban-env-host 21.2.0", + "static_assertions", + "thiserror", +] + +[[package]] +name = "soroban-simulation" +version = "22.0.0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=b01e79899ceeeb3d39f9531bbc09b39bf0149da8#b01e79899ceeeb3d39f9531bbc09b39bf0149da8" +dependencies = [ + "anyhow", + "rand", + "soroban-env-host 22.0.0", "static_assertions", "thiserror", ] @@ -1044,7 +1159,23 @@ dependencies = [ "smallvec", "spin", "wasmi_arena", - "wasmi_core", + "wasmi_core 0.13.0", + "wasmparser-nostd", +] + +[[package]] +name = "soroban-wasmi" +version = "0.36.0-soroban.22.0.0" +source = "git+https://github.com/stellar/wasmi?rev=122a74a7c491929e5ac9de876099154ef7c06d06#122a74a7c491929e5ac9de876099154ef7c06d06" +dependencies = [ + "arrayvec", + "multi-stash", + "num-derive", + "num-traits", + "smallvec", + "spin", + "wasmi_collections", + "wasmi_core 0.36.0-soroban.22.0.0", "wasmparser-nostd", ] @@ -1083,9 +1214,9 @@ dependencies = [ [[package]] name = "stellar-xdr" -version = "21.1.0" +version = "21.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec43c9c5ae7ec7b6ac9e263b6d5b9e3781aa05ba3a1c05f6e70701c5c6600665" +checksum = "2675a71212ed39a806e415b0dbf4702879ff288ec7f5ee996dda42a135512b50" dependencies = [ "arbitrary", "base64 0.13.1", @@ -1097,6 +1228,17 @@ dependencies = [ "stellar-strkey", ] +[[package]] +name = "string-interner" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c6a0d765f5807e98a091107bae0a56ea3799f66a5de47b2c84c94a39c09974e" +dependencies = [ + "cfg-if", + "hashbrown 0.14.3", + "serde", +] + [[package]] name = "strsim" version = "0.11.1" @@ -1255,6 +1397,16 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" +[[package]] +name = "wasmi_collections" +version = "0.36.0-soroban.22.0.0" +source = "git+https://github.com/stellar/wasmi?rev=122a74a7c491929e5ac9de876099154ef7c06d06#122a74a7c491929e5ac9de876099154ef7c06d06" +dependencies = [ + "ahash", + "hashbrown 0.14.3", + "string-interner", +] + [[package]] name = "wasmi_core" version = "0.13.0" @@ -1267,6 +1419,17 @@ dependencies = [ "paste", ] +[[package]] +name = "wasmi_core" +version = "0.36.0-soroban.22.0.0" +source = "git+https://github.com/stellar/wasmi?rev=122a74a7c491929e5ac9de876099154ef7c06d06#122a74a7c491929e5ac9de876099154ef7c06d06" +dependencies = [ + "downcast-rs", + "libm", + "num-traits", + "paste", +] + [[package]] name = "wasmparser" version = "0.116.1" @@ -1279,9 +1442,9 @@ dependencies = [ [[package]] name = "wasmparser-nostd" -version = "0.100.1" +version = "0.100.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9157cab83003221bfd385833ab587a039f5d6fa7304854042ba358a3b09e0724" +checksum = "d5a015fe95f3504a94bb1462c717aae75253e39b9dd6c3fb1062c934535c64aa" dependencies = [ "indexmap-nostd", ] @@ -1370,10 +1533,29 @@ dependencies = [ "rand", "serde_json", "sha2", - "soroban-env-host", "stellar-xdr", ] +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "zeroize" version = "1.7.0" diff --git a/Cargo.toml b/Cargo.toml index bdd76994..91d2b81b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,15 +8,28 @@ members = [ [workspace.package] rust-version = "1.74.0" +[workspace.dependencies.soroban-env-host-prev] +package = "soroban-env-host" +version = "=21.2.0" -[workspace.dependencies.soroban-env-host] -version = "=21.1.0" +[workspace.dependencies.soroban-env-host-curr] +package = "soroban-env-host" +version = "=22.0.0" +git = "https://github.com/stellar/rs-soroban-env" +rev = "b01e79899ceeeb3d39f9531bbc09b39bf0149da8" -[workspace.dependencies.soroban-simulation] -version = "=21.1.0" +[workspace.dependencies.soroban-simulation-prev] +package = "soroban-simulation" +version = "=21.2.0" + +[workspace.dependencies.soroban-simulation-curr] +package = "soroban-simulation" +version = "=22.0.0" +git = "https://github.com/stellar/rs-soroban-env" +rev = "b01e79899ceeeb3d39f9531bbc09b39bf0149da8" [workspace.dependencies.stellar-xdr] -version = "=21.1.0" +version = "=21.2.0" features = [ "serde" ] [workspace.dependencies] diff --git a/cmd/soroban-rpc/lib/preflight/Cargo.toml b/cmd/soroban-rpc/lib/preflight/Cargo.toml index 28e05689..539cddb2 100644 --- a/cmd/soroban-rpc/lib/preflight/Cargo.toml +++ b/cmd/soroban-rpc/lib/preflight/Cargo.toml @@ -15,8 +15,10 @@ sha2 = { workspace = true } # we need the testutils feature in order to get backtraces in the preflight library # when soroban rpc is configured to run with --preflight-enable-debug -soroban-env-host = { workspace = true, features = ["recording_mode", "testutils", "unstable-next-api"]} -soroban-simulation = { workspace = true } +soroban-env-host-prev = { workspace = true, features = ["recording_mode", "testutils", "unstable-next-api"]} +soroban-simulation-prev = { workspace = true } +soroban-env-host-curr = { workspace = true, features = ["recording_mode", "testutils", "unstable-next-api"]} +soroban-simulation-curr = { workspace = true } anyhow = { workspace = true } rand = { workspace = true } diff --git a/cmd/soroban-rpc/lib/preflight/src/lib.rs b/cmd/soroban-rpc/lib/preflight/src/lib.rs index e5834403..8c71f601 100644 --- a/cmd/soroban-rpc/lib/preflight/src/lib.rs +++ b/cmd/soroban-rpc/lib/preflight/src/lib.rs @@ -4,37 +4,53 @@ extern crate ffi; extern crate libc; extern crate serde_json; extern crate sha2; -extern crate soroban_env_host; -extern crate soroban_simulation; -use anyhow::{anyhow, bail, Result}; -use sha2::{Digest, Sha256}; +pub(crate) use anyhow::{anyhow, bail, Result}; +pub(crate) use sha2::{Digest, Sha256}; // We really do need everything. #[allow(clippy::wildcard_imports)] use ffi::*; - -use soroban_env_host::storage::EntryWithLiveUntil; -use soroban_env_host::xdr::{ - AccountId, ExtendFootprintTtlOp, Hash, InvokeHostFunctionOp, LedgerEntry, LedgerEntryData, - LedgerFootprint, LedgerKey, LedgerKeyTtl, OperationBody, ReadXdr, ScErrorCode, ScErrorType, - SorobanTransactionData, TtlEntry, WriteXdr, -}; -use soroban_env_host::{HostError, LedgerInfo, DEFAULT_XDR_RW_LIMITS}; -use soroban_simulation::simulation::{ - simulate_extend_ttl_op, simulate_invoke_host_function_op, simulate_restore_op, - InvokeHostFunctionSimulationResult, LedgerEntryDiff, RestoreOpSimulationResult, - SimulationAdjustmentConfig, -}; -use soroban_simulation::{AutoRestoringSnapshotSource, NetworkConfig, SnapshotSourceWithArchive}; +extern crate soroban_env_host_curr; +extern crate soroban_env_host_prev; +extern crate soroban_simulation_curr; +extern crate soroban_simulation_prev; + +// We support two different versions of soroban simutlaneously, switching on the +// protocol version each supports. This is the exact same mechanism we use in +// stellar-core to switch soroban hosts on protocol boundaries, and allows +// synchronously cutting over between significantly different versions of the +// host (or VM) without having to do fine-grained versioning within the VM. +// +// The way it is _accomplished_ is by mounting the same adaptor code (in +// `shared.rs`) at two different paths in the module tree, and then providing +// each with a different binding for the soroban host and simulation code. Any +// function that mentions a type from the soroban host or simulation code must +// be placed in the `shared.rs` file. Code that is host-version-agnostic can +// continue to live in this file. +// +// This is a bit of a hack, but it works well enough for our purposes and works +// around the absence of parametric modules in the Rust language. + +#[path = "."] +mod curr { + pub(crate) use soroban_env_host_curr as soroban_env_host; + pub(crate) use soroban_simulation_curr as soroban_simulation; + pub(crate) mod shared; +} + +#[path = "."] +mod prev { + pub(crate) use soroban_env_host_prev as soroban_env_host; + pub(crate) use soroban_simulation_prev as soroban_simulation; + pub(crate) mod shared; +} use std::cell::RefCell; -use std::convert::TryFrom; use std::ffi::CString; use std::mem; use std::panic; use std::ptr::null_mut; -use std::rc::Rc; #[repr(C)] #[derive(Copy, Clone)] @@ -47,20 +63,6 @@ pub struct CLedgerInfo { pub bucket_list_size: u64, } -fn fill_ledger_info(c_ledger_info: CLedgerInfo, network_config: &NetworkConfig) -> LedgerInfo { - let network_passphrase = unsafe { from_c_string(c_ledger_info.network_passphrase) }; - let mut ledger_info = LedgerInfo { - protocol_version: c_ledger_info.protocol_version, - sequence_number: c_ledger_info.sequence_number, - timestamp: c_ledger_info.timestamp, - network_id: Sha256::digest(network_passphrase).into(), - base_reserve: c_ledger_info.base_reserve, - ..Default::default() - }; - network_config.fill_config_fields_in_ledger_info(&mut ledger_info); - ledger_info -} - #[repr(C)] #[derive(Copy, Clone)] pub struct CXDRVector { @@ -149,55 +151,6 @@ impl Default for CPreflightResult { } } -impl CPreflightResult { - fn new_from_invoke_host_function( - invoke_hf_result: InvokeHostFunctionSimulationResult, - restore_preamble: Option, - error: String, - ) -> Self { - let mut result = Self { - error: string_to_c(error), - auth: xdr_vec_to_c(&invoke_hf_result.auth), - result: option_xdr_to_c(invoke_hf_result.invoke_result.ok().as_ref()), - min_fee: invoke_hf_result - .transaction_data - .as_ref() - .map_or_else(|| 0, |r| r.resource_fee), - transaction_data: option_xdr_to_c(invoke_hf_result.transaction_data.as_ref()), - // TODO: Diagnostic and contract events should be separated in the response - events: xdr_vec_to_c(&invoke_hf_result.diagnostic_events), - cpu_instructions: u64::from(invoke_hf_result.simulated_instructions), - memory_bytes: u64::from(invoke_hf_result.simulated_memory), - ledger_entry_diff: ledger_entry_diff_vec_to_c(&invoke_hf_result.modified_entries), - ..Default::default() - }; - if let Some(p) = restore_preamble { - result.pre_restore_min_fee = p.transaction_data.resource_fee; - result.pre_restore_transaction_data = xdr_to_c(&p.transaction_data); - }; - result - } - - fn new_from_transaction_data( - transaction_data: Option<&SorobanTransactionData>, - restore_preamble: Option<&RestoreOpSimulationResult>, - error: String, - ) -> Self { - let min_fee = transaction_data.map_or(0, |d| d.resource_fee); - let mut result = Self { - error: string_to_c(error), - transaction_data: option_xdr_to_c(transaction_data), - min_fee, - ..Default::default() - }; - if let Some(p) = restore_preamble { - result.pre_restore_min_fee = p.transaction_data.resource_fee; - result.pre_restore_transaction_data = xdr_to_c(&p.transaction_data); - }; - result - } -} - #[no_mangle] pub extern "C" fn preflight_invoke_hf_op( handle: libc::uintptr_t, // Go Handle to forward to SnapshotSourceGet and SnapshotSourceHas @@ -207,85 +160,32 @@ pub extern "C" fn preflight_invoke_hf_op( resource_config: CResourceConfig, enable_debug: bool, ) -> *mut CPreflightResult { + let proto = ledger_info.protocol_version; catch_preflight_panic(Box::new(move || { - preflight_invoke_hf_op_or_maybe_panic( - handle, - invoke_hf_op, - source_account, - ledger_info, - resource_config, - enable_debug, - ) + if proto <= prev::shared::PROTOCOL { + prev::shared::preflight_invoke_hf_op_or_maybe_panic( + handle, + invoke_hf_op, + source_account, + ledger_info, + resource_config, + enable_debug, + ) + } else if proto == curr::shared::PROTOCOL { + curr::shared::preflight_invoke_hf_op_or_maybe_panic( + handle, + invoke_hf_op, + source_account, + ledger_info, + resource_config, + enable_debug, + ) + } else { + bail!("unsupported protocol version: {}", proto) + } })) } -fn preflight_invoke_hf_op_or_maybe_panic( - handle: libc::uintptr_t, - invoke_hf_op: CXDR, // InvokeHostFunctionOp XDR in base64 - source_account: CXDR, // AccountId XDR in base64 - c_ledger_info: CLedgerInfo, - resource_config: CResourceConfig, - enable_debug: bool, -) -> Result { - let invoke_hf_op = - InvokeHostFunctionOp::from_xdr(unsafe { from_c_xdr(invoke_hf_op) }, DEFAULT_XDR_RW_LIMITS) - .unwrap(); - let source_account = - AccountId::from_xdr(unsafe { from_c_xdr(source_account) }, DEFAULT_XDR_RW_LIMITS).unwrap(); - - let go_storage = Rc::new(GoLedgerStorage::new(handle)); - let network_config = - NetworkConfig::load_from_snapshot(go_storage.as_ref(), c_ledger_info.bucket_list_size)?; - let ledger_info = fill_ledger_info(c_ledger_info, &network_config); - let auto_restore_snapshot = Rc::new(AutoRestoringSnapshotSource::new( - go_storage.clone(), - &ledger_info, - )?); - - let mut adjustment_config = SimulationAdjustmentConfig::default_adjustment(); - // It would be reasonable to extend `resource_config` to be compatible with `adjustment_config` - // in order to let the users customize the resource/fee adjustments in a more granular fashion. - - let instruction_leeway = u32::try_from(resource_config.instruction_leeway)?; - adjustment_config.instructions.additive_factor = adjustment_config - .instructions - .additive_factor - .max(instruction_leeway); - // Here we assume that no input auth means that the user requests the recording auth. - let auth_entries = if invoke_hf_op.auth.is_empty() { - None - } else { - Some(invoke_hf_op.auth.to_vec()) - }; - // Invoke the host function. The user errors should normally be captured in `invoke_hf_result.invoke_result` and - // this should return Err result for misconfigured ledger. - let invoke_hf_result = simulate_invoke_host_function_op( - auto_restore_snapshot.clone(), - &network_config, - &adjustment_config, - &ledger_info, - invoke_hf_op.host_function, - auth_entries, - &source_account, - rand::Rng::gen(&mut rand::thread_rng()), - enable_debug, - )?; - let maybe_restore_result = match &invoke_hf_result.invoke_result { - Ok(_) => auto_restore_snapshot.simulate_restore_keys_op( - &network_config, - &SimulationAdjustmentConfig::default_adjustment(), - &ledger_info, - ), - Err(e) => Err(e.clone().into()), - }; - let error_str = extract_error_string(&maybe_restore_result, go_storage.as_ref()); - Ok(CPreflightResult::new_from_invoke_host_function( - invoke_hf_result, - maybe_restore_result.unwrap_or(None), - error_str, - )) -} - #[no_mangle] pub extern "C" fn preflight_footprint_ttl_op( handle: libc::uintptr_t, // Go Handle to forward to SnapshotSourceGet and SnapshotSourceHas @@ -293,94 +193,26 @@ pub extern "C" fn preflight_footprint_ttl_op( footprint: CXDR, // LedgerFootprint XDR ledger_info: CLedgerInfo, ) -> *mut CPreflightResult { + let proto = ledger_info.protocol_version; catch_preflight_panic(Box::new(move || { - preflight_footprint_ttl_op_or_maybe_panic(handle, op_body, footprint, ledger_info) - })) -} - -fn preflight_footprint_ttl_op_or_maybe_panic( - handle: libc::uintptr_t, - op_body: CXDR, - footprint: CXDR, - c_ledger_info: CLedgerInfo, -) -> Result { - let op_body = OperationBody::from_xdr(unsafe { from_c_xdr(op_body) }, DEFAULT_XDR_RW_LIMITS)?; - let footprint = - LedgerFootprint::from_xdr(unsafe { from_c_xdr(footprint) }, DEFAULT_XDR_RW_LIMITS)?; - let go_storage = Rc::new(GoLedgerStorage::new(handle)); - let network_config = - NetworkConfig::load_from_snapshot(go_storage.as_ref(), c_ledger_info.bucket_list_size)?; - let ledger_info = fill_ledger_info(c_ledger_info, &network_config); - // TODO: It would make for a better UX if the user passed only the necessary fields for every operation. - // That would remove a possibility of providing bad operation body, or a possibility of filling wrong footprint - // field. - match op_body { - OperationBody::ExtendFootprintTtl(extend_op) => { - preflight_extend_ttl_op(&extend_op, footprint.read_only.as_slice(), &go_storage, &network_config, &ledger_info) - } - OperationBody::RestoreFootprint(_) => { - Ok(preflight_restore_op(footprint.read_write.as_slice(), &go_storage, &network_config, &ledger_info)) - } - _ => Err(anyhow!("encountered unsupported operation type: '{:?}', instead of 'ExtendFootprintTtl' or 'RestoreFootprint' operations.", - op_body.discriminant())) - } -} - -fn preflight_extend_ttl_op( - extend_op: &ExtendFootprintTtlOp, - keys_to_extend: &[LedgerKey], - go_storage: &Rc, - network_config: &NetworkConfig, - ledger_info: &LedgerInfo, -) -> Result { - let auto_restore_snapshot = AutoRestoringSnapshotSource::new(go_storage.clone(), ledger_info)?; - let simulation_result = simulate_extend_ttl_op( - &auto_restore_snapshot, - network_config, - &SimulationAdjustmentConfig::default_adjustment(), - ledger_info, - keys_to_extend, - extend_op.extend_to, - ); - let (maybe_transaction_data, maybe_restore_result) = match simulation_result { - Ok(r) => ( - Some(r.transaction_data), - auto_restore_snapshot.simulate_restore_keys_op( - network_config, - &SimulationAdjustmentConfig::default_adjustment(), + if proto <= prev::shared::PROTOCOL { + prev::shared::preflight_footprint_ttl_op_or_maybe_panic( + handle, + op_body, + footprint, ledger_info, - ), - ), - Err(e) => (None, Err(e)), - }; - - let error_str = extract_error_string(&maybe_restore_result, go_storage); - Ok(CPreflightResult::new_from_transaction_data( - maybe_transaction_data.as_ref(), - maybe_restore_result.ok().flatten().as_ref(), - error_str, - )) -} - -fn preflight_restore_op( - keys_to_restore: &[LedgerKey], - go_storage: &Rc, - network_config: &NetworkConfig, - ledger_info: &LedgerInfo, -) -> CPreflightResult { - let simulation_result = simulate_restore_op( - go_storage.as_ref(), - network_config, - &SimulationAdjustmentConfig::default_adjustment(), - ledger_info, - keys_to_restore, - ); - let error_str = extract_error_string(&simulation_result, go_storage.as_ref()); - CPreflightResult::new_from_transaction_data( - simulation_result.ok().map(|r| r.transaction_data).as_ref(), - None, - error_str, - ) + ) + } else if proto == curr::shared::PROTOCOL { + curr::shared::preflight_footprint_ttl_op_or_maybe_panic( + handle, + op_body, + footprint, + ledger_info, + ) + } else { + bail!("unsupported protocol version: {}", proto) + } + })) } fn preflight_error(str: String) -> CPreflightResult { @@ -409,37 +241,6 @@ fn catch_preflight_panic(op: Box Result>) -> *mut Box::into_raw(Box::new(c_preflight_result)) } -// TODO: We could use something like https://github.com/sonos/ffi-convert-rs -// to replace all the free_* , *_to_c and from_c_* functions by implementations of CDrop, -// CReprOf and AsRust -fn xdr_to_c(v: &impl WriteXdr) -> CXDR { - let (xdr, len) = vec_to_c_array(v.to_xdr(DEFAULT_XDR_RW_LIMITS).unwrap()); - CXDR { xdr, len } -} - -fn option_xdr_to_c(v: Option<&impl WriteXdr>) -> CXDR { - v.map_or( - CXDR { - xdr: null_mut(), - len: 0, - }, - xdr_to_c, - ) -} - -fn ledger_entry_diff_to_c(v: &LedgerEntryDiff) -> CXDRDiff { - CXDRDiff { - before: option_xdr_to_c(v.state_before.as_ref()), - after: option_xdr_to_c(v.state_after.as_ref()), - } -} - -fn xdr_vec_to_c(v: &[impl WriteXdr]) -> CXDRVector { - let c_v = v.iter().map(xdr_to_c).collect(); - let (array, len) = vec_to_c_array(c_v); - CXDRVector { array, len } -} - fn string_to_c(str: String) -> *mut libc::c_char { CString::new(str).unwrap().into_raw() } @@ -459,15 +260,6 @@ fn vec_to_c_array(mut v: Vec) -> (*mut T, libc::size_t) { (ptr, len) } -fn ledger_entry_diff_vec_to_c(modified_entries: &[LedgerEntryDiff]) -> CXDRDiffVector { - let c_diffs = modified_entries - .iter() - .map(ledger_entry_diff_to_c) - .collect(); - let (array, len) = vec_to_c_array(c_diffs); - CXDRDiffVector { array, len } -} - /// . /// /// # Safety @@ -557,71 +349,6 @@ impl GoLedgerStorage { unsafe { FreeGoXDR(res) }; Some(v) } - - // Gets a ledger entry by key, including the archived/removed entries. - // The failures of this function are not recoverable and should only happen when - // the underlying storage is somehow corrupted. - fn get_fallible(&self, key: &LedgerKey) -> Result> { - let mut key_xdr = key.to_xdr(DEFAULT_XDR_RW_LIMITS)?; - let Some(xdr) = self.get_xdr_internal(&mut key_xdr) else { - return Ok(None); - }; - - let live_until_ledger_seq = match key { - // TODO: it would probably be more efficient to do all of this in the Go side - // (e.g. it would allow us to query multiple entries at once) - LedgerKey::ContractData(_) | LedgerKey::ContractCode(_) => { - let key_hash: [u8; 32] = Sha256::digest(key_xdr).into(); - let ttl_key = LedgerKey::Ttl(LedgerKeyTtl { - key_hash: Hash(key_hash), - }); - let mut ttl_key_xdr = ttl_key.to_xdr(DEFAULT_XDR_RW_LIMITS)?; - let ttl_entry_xdr = self.get_xdr_internal(&mut ttl_key_xdr).ok_or_else(|| { - anyhow!( - "TTL entry is missing for an entry that should have TTL with key: '{key:?}'" - ) - })?; - let ttl_entry = LedgerEntry::from_xdr(ttl_entry_xdr, DEFAULT_XDR_RW_LIMITS)?; - let LedgerEntryData::Ttl(TtlEntry { - live_until_ledger_seq, - .. - }) = ttl_entry.data - else { - bail!( - "unexpected non-TTL entry '{:?}' has been fetched for TTL key '{:?}'", - ttl_entry, - ttl_key - ); - }; - Some(live_until_ledger_seq) - } - _ => None, - }; - - let entry = LedgerEntry::from_xdr(xdr, DEFAULT_XDR_RW_LIMITS)?; - Ok(Some((Rc::new(entry), live_until_ledger_seq))) - } -} - -impl SnapshotSourceWithArchive for GoLedgerStorage { - fn get_including_archived( - &self, - key: &Rc, - ) -> std::result::Result, HostError> { - let res = self.get_fallible(key.as_ref()); - match res { - Ok(res) => Ok(res), - Err(e) => { - // Store the internal error in the storage as the info won't be propagated from simulation. - if let Ok(mut err) = self.internal_error.try_borrow_mut() { - *err = Some(e); - } - // Errors that occur in storage are not recoverable, so we force host to halt by passing - // it an internal error. - Err((ScErrorType::Storage, ScErrorCode::InternalError).into()) - } - } - } } fn extract_error_string(simulation_result: &Result, go_storage: &GoLedgerStorage) -> String { diff --git a/cmd/soroban-rpc/lib/preflight/src/shared.rs b/cmd/soroban-rpc/lib/preflight/src/shared.rs new file mode 100644 index 00000000..a517eadd --- /dev/null +++ b/cmd/soroban-rpc/lib/preflight/src/shared.rs @@ -0,0 +1,379 @@ +// This file is included into the module graph as two different modules: +// +// - crate::prev::shared for the previous protocol +// - crate::curr::shared for the previous protocol +// +// This file is the `shared` part of that path, and there is a different binding +// for `soroban_env_host`` and `soroban_simulation`` in each of the two parent +// modules `crate::prev` and `crate::curr`, corresponding to two different +// releases of soroban. +// +// We therefore import the different bindings for anything we use from +// `soroban_env_host` or `soroban_simulation` from `super::` rather than +// `crate::`. + +use super::soroban_env_host::storage::EntryWithLiveUntil; +use super::soroban_env_host::xdr::{ + AccountId, ExtendFootprintTtlOp, Hash, InvokeHostFunctionOp, LedgerEntry, LedgerEntryData, + LedgerFootprint, LedgerKey, LedgerKeyTtl, OperationBody, ReadXdr, ScErrorCode, ScErrorType, + SorobanTransactionData, TtlEntry, WriteXdr, +}; +use super::soroban_env_host::{meta, HostError, LedgerInfo, DEFAULT_XDR_RW_LIMITS}; +use super::soroban_simulation::simulation::{ + simulate_extend_ttl_op, simulate_invoke_host_function_op, simulate_restore_op, + InvokeHostFunctionSimulationResult, LedgerEntryDiff, RestoreOpSimulationResult, + SimulationAdjustmentConfig, +}; +use super::soroban_simulation::{ + AutoRestoringSnapshotSource, NetworkConfig, SnapshotSourceWithArchive, +}; + +// Any definition that doesn't mention a soroban type in its signature can be +// stored in the common grandparent module `crate` a.k.a. `lib.rs`. Both copies +// of the `shared` module import the same definitions for these. + +use crate::{ + anyhow, bail, extract_error_string, from_c_string, from_c_xdr, string_to_c, vec_to_c_array, + CLedgerInfo, CPreflightResult, CResourceConfig, CXDRDiff, CXDRDiffVector, CXDRVector, Digest, + GoLedgerStorage, Result, Sha256, CXDR, +}; +use std::convert::TryFrom; +use std::ptr::null_mut; +use std::rc::Rc; + +pub(crate) const PROTOCOL: u32 = meta::get_ledger_protocol_version(meta::INTERFACE_VERSION); + +fn fill_ledger_info(c_ledger_info: CLedgerInfo, network_config: &NetworkConfig) -> LedgerInfo { + let network_passphrase = unsafe { from_c_string(c_ledger_info.network_passphrase) }; + let mut ledger_info = LedgerInfo { + protocol_version: c_ledger_info.protocol_version, + sequence_number: c_ledger_info.sequence_number, + timestamp: c_ledger_info.timestamp, + network_id: Sha256::digest(network_passphrase).into(), + base_reserve: c_ledger_info.base_reserve, + ..Default::default() + }; + network_config.fill_config_fields_in_ledger_info(&mut ledger_info); + ledger_info +} + +// This has to be a free function rather than a method on an impl because there +// are two copies of this file mounted in the module tree and we can't define a +// same-named method on a single Self-type twice. +fn new_cpreflight_result_from_invoke_host_function( + invoke_hf_result: InvokeHostFunctionSimulationResult, + restore_preamble: Option, + error: String, +) -> CPreflightResult { + let mut result = CPreflightResult { + error: string_to_c(error), + auth: xdr_vec_to_c(&invoke_hf_result.auth), + result: option_xdr_to_c(invoke_hf_result.invoke_result.ok().as_ref()), + min_fee: invoke_hf_result + .transaction_data + .as_ref() + .map_or_else(|| 0, |r| r.resource_fee), + transaction_data: option_xdr_to_c(invoke_hf_result.transaction_data.as_ref()), + // TODO: Diagnostic and contract events should be separated in the response + events: xdr_vec_to_c(&invoke_hf_result.diagnostic_events), + cpu_instructions: u64::from(invoke_hf_result.simulated_instructions), + memory_bytes: u64::from(invoke_hf_result.simulated_memory), + ledger_entry_diff: ledger_entry_diff_vec_to_c(&invoke_hf_result.modified_entries), + ..Default::default() + }; + if let Some(p) = restore_preamble { + result.pre_restore_min_fee = p.transaction_data.resource_fee; + result.pre_restore_transaction_data = xdr_to_c(&p.transaction_data); + }; + result +} + +// This has to be a free function rather than a method on an impl because there +// are two copies of this file mounted in the module tree and we can't define a +// same-named method on a single Self-type twice. +fn new_cpreflight_result_from_transaction_data( + transaction_data: Option<&SorobanTransactionData>, + restore_preamble: Option<&RestoreOpSimulationResult>, + error: String, +) -> CPreflightResult { + let min_fee = transaction_data.map_or(0, |d| d.resource_fee); + let mut result = CPreflightResult { + error: string_to_c(error), + transaction_data: option_xdr_to_c(transaction_data), + min_fee, + ..Default::default() + }; + if let Some(p) = restore_preamble { + result.pre_restore_min_fee = p.transaction_data.resource_fee; + result.pre_restore_transaction_data = xdr_to_c(&p.transaction_data); + }; + result +} + +pub(crate) fn preflight_invoke_hf_op_or_maybe_panic( + handle: libc::uintptr_t, + invoke_hf_op: CXDR, // InvokeHostFunctionOp XDR in base64 + source_account: CXDR, // AccountId XDR in base64 + c_ledger_info: CLedgerInfo, + resource_config: CResourceConfig, + enable_debug: bool, +) -> Result { + let invoke_hf_op = + InvokeHostFunctionOp::from_xdr(unsafe { from_c_xdr(invoke_hf_op) }, DEFAULT_XDR_RW_LIMITS) + .unwrap(); + let source_account = + AccountId::from_xdr(unsafe { from_c_xdr(source_account) }, DEFAULT_XDR_RW_LIMITS).unwrap(); + + let go_storage = Rc::new(GoLedgerStorage::new(handle)); + let network_config = + NetworkConfig::load_from_snapshot(go_storage.as_ref(), c_ledger_info.bucket_list_size)?; + let ledger_info = fill_ledger_info(c_ledger_info, &network_config); + let auto_restore_snapshot = Rc::new(AutoRestoringSnapshotSource::new( + go_storage.clone(), + &ledger_info, + )?); + + let mut adjustment_config = SimulationAdjustmentConfig::default_adjustment(); + // It would be reasonable to extend `resource_config` to be compatible with `adjustment_config` + // in order to let the users customize the resource/fee adjustments in a more granular fashion. + + let instruction_leeway = u32::try_from(resource_config.instruction_leeway)?; + adjustment_config.instructions.additive_factor = adjustment_config + .instructions + .additive_factor + .max(instruction_leeway); + // Here we assume that no input auth means that the user requests the recording auth. + let auth_entries = if invoke_hf_op.auth.is_empty() { + None + } else { + Some(invoke_hf_op.auth.to_vec()) + }; + // Invoke the host function. The user errors should normally be captured in `invoke_hf_result.invoke_result` and + // this should return Err result for misconfigured ledger. + let invoke_hf_result = simulate_invoke_host_function_op( + auto_restore_snapshot.clone(), + &network_config, + &adjustment_config, + &ledger_info, + invoke_hf_op.host_function, + auth_entries, + &source_account, + rand::Rng::gen(&mut rand::thread_rng()), + enable_debug, + )?; + let maybe_restore_result = match &invoke_hf_result.invoke_result { + Ok(_) => auto_restore_snapshot.simulate_restore_keys_op( + &network_config, + &SimulationAdjustmentConfig::default_adjustment(), + &ledger_info, + ), + Err(e) => Err(e.clone().into()), + }; + let error_str = extract_error_string(&maybe_restore_result, go_storage.as_ref()); + Ok(new_cpreflight_result_from_invoke_host_function( + invoke_hf_result, + maybe_restore_result.unwrap_or(None), + error_str, + )) +} + +pub(crate) fn preflight_footprint_ttl_op_or_maybe_panic( + handle: libc::uintptr_t, + op_body: CXDR, + footprint: CXDR, + c_ledger_info: CLedgerInfo, +) -> Result { + let op_body = OperationBody::from_xdr(unsafe { from_c_xdr(op_body) }, DEFAULT_XDR_RW_LIMITS)?; + let footprint = + LedgerFootprint::from_xdr(unsafe { from_c_xdr(footprint) }, DEFAULT_XDR_RW_LIMITS)?; + let go_storage = Rc::new(GoLedgerStorage::new(handle)); + let network_config = + NetworkConfig::load_from_snapshot(go_storage.as_ref(), c_ledger_info.bucket_list_size)?; + let ledger_info = fill_ledger_info(c_ledger_info, &network_config); + // TODO: It would make for a better UX if the user passed only the necessary fields for every operation. + // That would remove a possibility of providing bad operation body, or a possibility of filling wrong footprint + // field. + match op_body { + OperationBody::ExtendFootprintTtl(extend_op) => { + preflight_extend_ttl_op(&extend_op, footprint.read_only.as_slice(), &go_storage, &network_config, &ledger_info) + } + OperationBody::RestoreFootprint(_) => { + Ok(preflight_restore_op(footprint.read_write.as_slice(), &go_storage, &network_config, &ledger_info)) + } + _ => Err(anyhow!("encountered unsupported operation type: '{:?}', instead of 'ExtendFootprintTtl' or 'RestoreFootprint' operations.", + op_body.discriminant())) + } +} + +fn preflight_extend_ttl_op( + extend_op: &ExtendFootprintTtlOp, + keys_to_extend: &[LedgerKey], + go_storage: &Rc, + network_config: &NetworkConfig, + ledger_info: &LedgerInfo, +) -> Result { + let auto_restore_snapshot = AutoRestoringSnapshotSource::new(go_storage.clone(), ledger_info)?; + let simulation_result = simulate_extend_ttl_op( + &auto_restore_snapshot, + network_config, + &SimulationAdjustmentConfig::default_adjustment(), + ledger_info, + keys_to_extend, + extend_op.extend_to, + ); + let (maybe_transaction_data, maybe_restore_result) = match simulation_result { + Ok(r) => ( + Some(r.transaction_data), + auto_restore_snapshot.simulate_restore_keys_op( + network_config, + &SimulationAdjustmentConfig::default_adjustment(), + ledger_info, + ), + ), + Err(e) => (None, Err(e)), + }; + + let error_str = extract_error_string(&maybe_restore_result, go_storage); + Ok(new_cpreflight_result_from_transaction_data( + maybe_transaction_data.as_ref(), + maybe_restore_result.ok().flatten().as_ref(), + error_str, + )) +} + +fn preflight_restore_op( + keys_to_restore: &[LedgerKey], + go_storage: &Rc, + network_config: &NetworkConfig, + ledger_info: &LedgerInfo, +) -> CPreflightResult { + let simulation_result = simulate_restore_op( + go_storage.as_ref(), + network_config, + &SimulationAdjustmentConfig::default_adjustment(), + ledger_info, + keys_to_restore, + ); + let error_str = extract_error_string(&simulation_result, go_storage.as_ref()); + new_cpreflight_result_from_transaction_data( + simulation_result.ok().map(|r| r.transaction_data).as_ref(), + None, + error_str, + ) +} + +// TODO: We could use something like https://github.com/sonos/ffi-convert-rs +// to replace all the free_* , *_to_c and from_c_* functions by implementations of CDrop, +// CReprOf and AsRust +fn xdr_to_c(v: &impl WriteXdr) -> CXDR { + let (xdr, len) = vec_to_c_array(v.to_xdr(DEFAULT_XDR_RW_LIMITS).unwrap()); + CXDR { xdr, len } +} + +fn option_xdr_to_c(v: Option<&impl WriteXdr>) -> CXDR { + v.map_or( + CXDR { + xdr: null_mut(), + len: 0, + }, + xdr_to_c, + ) +} + +fn ledger_entry_diff_to_c(v: &LedgerEntryDiff) -> CXDRDiff { + CXDRDiff { + before: option_xdr_to_c(v.state_before.as_ref()), + after: option_xdr_to_c(v.state_after.as_ref()), + } +} + +fn xdr_vec_to_c(v: &[impl WriteXdr]) -> CXDRVector { + let c_v = v.iter().map(xdr_to_c).collect(); + let (array, len) = vec_to_c_array(c_v); + CXDRVector { array, len } +} + +fn ledger_entry_diff_vec_to_c(modified_entries: &[LedgerEntryDiff]) -> CXDRDiffVector { + let c_diffs = modified_entries + .iter() + .map(ledger_entry_diff_to_c) + .collect(); + let (array, len) = vec_to_c_array(c_diffs); + CXDRDiffVector { array, len } +} + +// Gets a ledger entry by key, including the archived/removed entries. +// The failures of this function are not recoverable and should only happen when +// the underlying storage is somehow corrupted. +// +// This has to be a free function rather than a method on an impl because there +// are two copies of this file mounted in the module tree and we can't define a +// same-named method on a single Self-type twice. +fn get_fallible_from_go_ledger_storage( + storage: &GoLedgerStorage, + key: &LedgerKey, +) -> Result> { + let mut key_xdr = key.to_xdr(DEFAULT_XDR_RW_LIMITS)?; + let Some(xdr) = storage.get_xdr_internal(&mut key_xdr) else { + return Ok(None); + }; + + let live_until_ledger_seq = match key { + // TODO: it would probably be more efficient to do all of this in the Go side + // (e.g. it would allow us to query multiple entries at once) + LedgerKey::ContractData(_) | LedgerKey::ContractCode(_) => { + let key_hash: [u8; 32] = Sha256::digest(key_xdr).into(); + let ttl_key = LedgerKey::Ttl(LedgerKeyTtl { + key_hash: Hash(key_hash), + }); + let mut ttl_key_xdr = ttl_key.to_xdr(DEFAULT_XDR_RW_LIMITS)?; + let ttl_entry_xdr = storage.get_xdr_internal(&mut ttl_key_xdr).ok_or_else(|| { + anyhow!( + "TTL entry is missing for an entry that should have TTL with key: '{key:?}'" + ) + })?; + let ttl_entry = LedgerEntry::from_xdr(ttl_entry_xdr, DEFAULT_XDR_RW_LIMITS)?; + let LedgerEntryData::Ttl(TtlEntry { + live_until_ledger_seq, + .. + }) = ttl_entry.data + else { + bail!( + "unexpected non-TTL entry '{:?}' has been fetched for TTL key '{:?}'", + ttl_entry, + ttl_key + ); + }; + Some(live_until_ledger_seq) + } + _ => None, + }; + + let entry = LedgerEntry::from_xdr(xdr, DEFAULT_XDR_RW_LIMITS)?; + Ok(Some((Rc::new(entry), live_until_ledger_seq))) +} + +// We can do an impl here because the two `SnapshotSourceWithArchive` traits +// originate in _separate crates_ and so are considered distinct. So rustc sees +// `GoLedgerStorage` impl'ing two different traits that just happen to have the +// same name. +impl SnapshotSourceWithArchive for GoLedgerStorage { + fn get_including_archived( + &self, + key: &Rc, + ) -> std::result::Result, HostError> { + let res = get_fallible_from_go_ledger_storage(self, key.as_ref()); + match res { + Ok(res) => Ok(res), + Err(e) => { + // Store the internal error in the storage as the info won't be propagated from simulation. + if let Ok(mut err) = self.internal_error.try_borrow_mut() { + *err = Some(e); + } + // Errors that occur in storage are not recoverable, so we force host to halt by passing + // it an internal error. + Err((ScErrorType::Storage, ScErrorCode::InternalError).into()) + } + } + } +} From f74cbf537364b75acc3c3d077a9c78dd0c7316c5 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Tue, 13 Aug 2024 15:57:55 -0700 Subject: [PATCH 06/19] make clippy happy --- cmd/soroban-rpc/lib/preflight/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/soroban-rpc/lib/preflight/src/lib.rs b/cmd/soroban-rpc/lib/preflight/src/lib.rs index 8c71f601..b762db60 100644 --- a/cmd/soroban-rpc/lib/preflight/src/lib.rs +++ b/cmd/soroban-rpc/lib/preflight/src/lib.rs @@ -36,6 +36,7 @@ extern crate soroban_simulation_prev; mod curr { pub(crate) use soroban_env_host_curr as soroban_env_host; pub(crate) use soroban_simulation_curr as soroban_simulation; + #[allow(clippy::duplicate_mod)] pub(crate) mod shared; } @@ -43,6 +44,7 @@ mod curr { mod prev { pub(crate) use soroban_env_host_prev as soroban_env_host; pub(crate) use soroban_simulation_prev as soroban_simulation; + #[allow(clippy::duplicate_mod)] pub(crate) mod shared; } From b20b4025261e2e73490997b24f41f0609fa2bd36 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Thu, 29 Aug 2024 23:50:15 -0700 Subject: [PATCH 07/19] update check-dependencies.bash to understand multiple protocols --- scripts/check-dependencies.bash | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/scripts/check-dependencies.bash b/scripts/check-dependencies.bash index 56f9510a..975da85a 100755 --- a/scripts/check-dependencies.bash +++ b/scripts/check-dependencies.bash @@ -9,20 +9,30 @@ fi CURL="curl -sL --fail-with-body" -if ! CARGO_OUTPUT=$(cargo tree -p soroban-env-host 2>&1); then - echo "The project depends on multiple versions of the soroban-env-host Rust library, please unify them." - echo "Make sure the soroban-sdk dependency indirectly points to the same soroban-env-host dependency imported explicitly." - echo - echo "This is soroban-env-host version imported by soroban-sdk:" - cargo tree --depth 1 -p soroban-sdk | grep env-host - echo - echo - echo - echo "Full error:" - echo $CARGO_OUTPUT +PROTOS=$($SED -n ':pkg; /"soroban-env-host"/ {n; /version/ { s/[^0-9]*\([0-9]\+\).*/\1/ p; b pkg;}}' Cargo.toml | tr '\n' ' ') +if [ -z "$PROTOS" ]; then + echo "Cannot find soroban-env-host dependencies in Cargo.toml" exit 1 +else + echo "Found supported protocols: $PROTOS" fi +for PROTO in $PROTOS +do + if ! CARGO_OUTPUT=$(cargo tree -p soroban-env-host@$PROTO 2>&1); then + echo "The project depends on multiple versions of the soroban-env-host@$PROTO Rust library, please unify them." + echo "Make sure the soroban-sdk dependency indirectly points to the same soroban-env-host@$PROTO dependency imported explicitly." + echo + echo "This is soroban-env-host version imported by soroban-sdk:" + cargo tree --depth 1 -p soroban-sdk | grep env-host + echo + echo + echo + echo "Full error:" + echo $CARGO_OUTPUT + exit 1 + fi +done # revision of the https://github.com/stellar/rs-stellar-xdr library used by the Rust code RS_STELLAR_XDR_REVISION="" From 92fa9a4dd92f67a553f707cad74183c049240fff Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Thu, 29 Aug 2024 23:57:11 -0700 Subject: [PATCH 08/19] Move to env commit that actually got merged --- Cargo.lock | 33 +++++++++++++++++++++++---------- Cargo.toml | 4 ++-- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 699be22f..4c50e264 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -988,7 +988,7 @@ dependencies = [ [[package]] name = "soroban-builtin-sdk-macros" version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=b01e79899ceeeb3d39f9531bbc09b39bf0149da8#b01e79899ceeeb3d39f9531bbc09b39bf0149da8" +source = "git+https://github.com/stellar/rs-soroban-env?rev=4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4#4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4" dependencies = [ "itertools", "proc-macro2", @@ -1010,14 +1010,14 @@ dependencies = [ "soroban-env-macros 21.2.0", "soroban-wasmi 0.31.1-soroban.20.0.1", "static_assertions", - "stellar-xdr", + "stellar-xdr 21.2.0", "wasmparser", ] [[package]] name = "soroban-env-common" version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=b01e79899ceeeb3d39f9531bbc09b39bf0149da8#b01e79899ceeeb3d39f9531bbc09b39bf0149da8" +source = "git+https://github.com/stellar/rs-soroban-env?rev=4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4#4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4" dependencies = [ "arbitrary", "crate-git-revision", @@ -1027,7 +1027,7 @@ dependencies = [ "soroban-env-macros 22.0.0", "soroban-wasmi 0.36.0-soroban.22.0.0", "static_assertions", - "stellar-xdr", + "stellar-xdr 22.0.0", "wasmparser", ] @@ -1067,7 +1067,7 @@ dependencies = [ [[package]] name = "soroban-env-host" version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=b01e79899ceeeb3d39f9531bbc09b39bf0149da8#b01e79899ceeeb3d39f9531bbc09b39bf0149da8" +source = "git+https://github.com/stellar/rs-soroban-env?rev=4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4#4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4" dependencies = [ "backtrace", "curve25519-dalek", @@ -1107,21 +1107,21 @@ dependencies = [ "quote", "serde", "serde_json", - "stellar-xdr", + "stellar-xdr 21.2.0", "syn", ] [[package]] name = "soroban-env-macros" version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=b01e79899ceeeb3d39f9531bbc09b39bf0149da8#b01e79899ceeeb3d39f9531bbc09b39bf0149da8" +source = "git+https://github.com/stellar/rs-soroban-env?rev=4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4#4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4" dependencies = [ "itertools", "proc-macro2", "quote", "serde", "serde_json", - "stellar-xdr", + "stellar-xdr 22.0.0", "syn", ] @@ -1141,7 +1141,7 @@ dependencies = [ [[package]] name = "soroban-simulation" version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=b01e79899ceeeb3d39f9531bbc09b39bf0149da8#b01e79899ceeeb3d39f9531bbc09b39bf0149da8" +source = "git+https://github.com/stellar/rs-soroban-env?rev=4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4#4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4" dependencies = [ "anyhow", "rand", @@ -1228,6 +1228,19 @@ dependencies = [ "stellar-strkey", ] +[[package]] +name = "stellar-xdr" +version = "22.0.0" +source = "git+https://github.com/stellar/rs-stellar-xdr?rev=550743b50cd3ca5a63f03f9d7175b4cfdfd9c4ac#550743b50cd3ca5a63f03f9d7175b4cfdfd9c4ac" +dependencies = [ + "arbitrary", + "base64 0.13.1", + "crate-git-revision", + "escape-bytes", + "hex", + "stellar-strkey", +] + [[package]] name = "string-interner" version = "0.17.0" @@ -1533,7 +1546,7 @@ dependencies = [ "rand", "serde_json", "sha2", - "stellar-xdr", + "stellar-xdr 21.2.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 91d2b81b..e80016ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ version = "=21.2.0" package = "soroban-env-host" version = "=22.0.0" git = "https://github.com/stellar/rs-soroban-env" -rev = "b01e79899ceeeb3d39f9531bbc09b39bf0149da8" +rev = "4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4" [workspace.dependencies.soroban-simulation-prev] package = "soroban-simulation" @@ -26,7 +26,7 @@ version = "=21.2.0" package = "soroban-simulation" version = "=22.0.0" git = "https://github.com/stellar/rs-soroban-env" -rev = "b01e79899ceeeb3d39f9531bbc09b39bf0149da8" +rev = "4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4" [workspace.dependencies.stellar-xdr] version = "=21.2.0" From 9ca3df2fdf2b0847e4f78d03163c6a1e3d76bc67 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Fri, 30 Aug 2024 00:19:43 -0700 Subject: [PATCH 09/19] More fixes to check-dependencies.bash --- scripts/check-dependencies.bash | 44 ++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/scripts/check-dependencies.bash b/scripts/check-dependencies.bash index 975da85a..aa6a9b3a 100755 --- a/scripts/check-dependencies.bash +++ b/scripts/check-dependencies.bash @@ -9,7 +9,10 @@ fi CURL="curl -sL --fail-with-body" -PROTOS=$($SED -n ':pkg; /"soroban-env-host"/ {n; /version/ { s/[^0-9]*\([0-9]\+\).*/\1/ p; b pkg;}}' Cargo.toml | tr '\n' ' ') +# PROTOS is in ascending order so the last iteration of the PROTOS-based loops +# will end up with the highest protocol value used for recording any state +# variables. +PROTOS=$($SED -n ':pkg; /"soroban-env-host"/ {n; /version/ { s/[^0-9]*\([0-9]\+\).*/\1/ p; b pkg;}}' Cargo.toml | sort -n | tr '\n' ' ') if [ -z "$PROTOS" ]; then echo "Cannot find soroban-env-host dependencies in Cargo.toml" exit 1 @@ -52,25 +55,28 @@ function stellar_xdr_version_from_rust_dep_tree { echo $LINE | $SED -n 's/.*stellar-xdr \(v\)\{0,1\}\([^ ]*\).*/\2/p' } -if CARGO_OUTPUT=$(cargo tree --depth 0 -p stellar-xdr 2>&1); then - RS_STELLAR_XDR_REVISION=$(echo "$CARGO_OUTPUT" | stellar_xdr_version_from_rust_dep_tree) - if [ ${#RS_STELLAR_XDR_REVISION} -eq 40 ]; then - # revision is a git hash - STELLAR_XDR_REVISION_FROM_RUST=$($CURL https://raw.githubusercontent.com/stellar/rs-stellar-xdr/${RS_STELLAR_XDR_REVISION}/xdr/curr-version) +for PROTO in $PROTOS +do + if CARGO_OUTPUT=$(cargo tree --depth 0 -p stellar-xdr@$PROTO 2>&1); then + RS_STELLAR_XDR_REVISION=$(echo "$CARGO_OUTPUT" | stellar_xdr_version_from_rust_dep_tree) + if [ ${#RS_STELLAR_XDR_REVISION} -eq 40 ]; then + # revision is a git hash + STELLAR_XDR_REVISION_FROM_RUST=$($CURL https://raw.githubusercontent.com/stellar/rs-stellar-xdr/${RS_STELLAR_XDR_REVISION}/xdr/curr-version) + else + # revision is a crate version + CARGO_SRC_BASE_DIR=$(realpath ${CARGO_HOME:-$HOME/.cargo}/registry/src/index*) + STELLAR_XDR_REVISION_FROM_RUST=$(cat "${CARGO_SRC_BASE_DIR}/stellar-xdr-${RS_STELLAR_XDR_REVISION}/xdr/curr-version") + fi else - # revision is a crate version - CARGO_SRC_BASE_DIR=$(realpath ${CARGO_HOME:-$HOME/.cargo}/registry/src/index*) - STELLAR_XDR_REVISION_FROM_RUST=$(cat "${CARGO_SRC_BASE_DIR}/stellar-xdr-${RS_STELLAR_XDR_REVISION}/xdr/curr-version") + echo "The project depends on multiple versions of the Rust rs-stellar-xdr@$PROTO library" + echo "Make sure a single version of stellar-xdr@$PROTO is used" + echo + echo + echo + echo "Full error:" + echo $CARGO_OUTPUT fi -else - echo "The project depends on multiple versions of the Rust rs-stellar-xdr library" - echo "Make sure a single version of stellar-xdr is used" - echo - echo - echo - echo "Full error:" - echo $CARGO_OUTPUT -fi +done # Now, lets compare the Rust and Go XDR revisions # TODO: The sed extraction below won't work for version tags @@ -120,5 +126,3 @@ for P in $PROTOCOL_VERSIONS; do fi done - - From 7913265938a8f5bc8b5fbdb4b83774eb5c78359b Mon Sep 17 00:00:00 2001 From: Prit Sheth <124409873+psheth9@users.noreply.github.com> Date: Fri, 30 Aug 2024 10:13:37 -0700 Subject: [PATCH 10/19] Cleanup old retention window and upgrade history-retention-window (#277) * Cleanup old retention-windows and increase history-retention-window to 7 days * fix tests --- cmd/soroban-rpc/internal/config/main.go | 9 ---- cmd/soroban-rpc/internal/config/options.go | 28 ++-------- cmd/soroban-rpc/internal/config/toml_test.go | 6 +-- cmd/soroban-rpc/internal/db/db.go | 54 ++++++++++---------- 4 files changed, 33 insertions(+), 64 deletions(-) diff --git a/cmd/soroban-rpc/internal/config/main.go b/cmd/soroban-rpc/internal/config/main.go index 4282d824..26a38802 100644 --- a/cmd/soroban-rpc/internal/config/main.go +++ b/cmd/soroban-rpc/internal/config/main.go @@ -26,7 +26,6 @@ type Config struct { CoreRequestTimeout time.Duration DefaultEventsLimit uint DefaultTransactionsLimit uint - EventLedgerRetentionWindow uint32 FriendbotURL string HistoryArchiveURLs []string HistoryArchiveUserAgent string @@ -42,7 +41,6 @@ type Config struct { PreflightEnableDebug bool SQLiteDBPath string HistoryRetentionWindow uint32 - TransactionLedgerRetentionWindow uint32 SorobanFeeStatsLedgerRetentionWindow uint32 ClassicFeeStatsLedgerRetentionWindow uint32 RequestBacklogGlobalQueueLimit uint @@ -115,13 +113,6 @@ func (cfg *Config) SetValues(lookupEnv func(string) (string, bool)) error { } } - // Set to the maximum as a compromise until we deprecate the transaction/event flags - cfg.HistoryRetentionWindow = max( - cfg.HistoryRetentionWindow, - cfg.EventLedgerRetentionWindow, - cfg.TransactionLedgerRetentionWindow, - ) - return nil } diff --git a/cmd/soroban-rpc/internal/config/options.go b/cmd/soroban-rpc/internal/config/options.go index 58df85e2..74a4931b 100644 --- a/cmd/soroban-rpc/internal/config/options.go +++ b/cmd/soroban-rpc/internal/config/options.go @@ -218,32 +218,10 @@ func (cfg *Config) options() Options { Name: "history-retention-window", Usage: fmt.Sprintf( "configures history retention window for transactions and events, expressed in number of ledgers,"+ - " the default value is %d which corresponds to about 24 hours of history", - OneDayOfLedgers), + " the default value is %d which corresponds to about 7 days of history", + SevenDayOfLedgers), ConfigKey: &cfg.HistoryRetentionWindow, - DefaultValue: uint32(OneDayOfLedgers), - Validate: positive, - }, - // TODO: remove - { - Name: "event-retention-window", - Usage: fmt.Sprintf( - "(Deprecated, overidden by history-retention-window) configures the event retention window expressed in number of ledgers,"+ - " the default value is %d which corresponds to about 24 hours of history", - OneDayOfLedgers), - ConfigKey: &cfg.EventLedgerRetentionWindow, - DefaultValue: uint32(OneDayOfLedgers), - Validate: positive, - }, - // TODO: remove - { - Name: "transaction-retention-window", - Usage: fmt.Sprintf( - "(Deprecated, overidden by history-retention-window) configures the transaction retention window expressed in number of ledgers,"+ - " the default value is %d which corresponds to about 24 hours of history", - OneDayOfLedgers), - ConfigKey: &cfg.TransactionLedgerRetentionWindow, - DefaultValue: uint32(OneDayOfLedgers), + DefaultValue: uint32(SevenDayOfLedgers), Validate: positive, }, { diff --git a/cmd/soroban-rpc/internal/config/toml_test.go b/cmd/soroban-rpc/internal/config/toml_test.go index ae762567..74c0ac41 100644 --- a/cmd/soroban-rpc/internal/config/toml_test.go +++ b/cmd/soroban-rpc/internal/config/toml_test.go @@ -93,9 +93,9 @@ func TestBasicTomlWriting(t *testing.T) { // comment when outputting multi-line comments, which go-toml does *not* do // by default. assert.Contains(t, out, - `# (Deprecated, overidden by history-retention-window) configures the event -# retention window expressed in number of ledgers, the default value is 17280 -# which corresponds to about 24 hours of history`) + `# configures history retention window for transactions and events, expressed in +# number of ledgers, the default value is 120960 which corresponds to about 7 +# days of history`) } func TestRoundTrip(t *testing.T) { diff --git a/cmd/soroban-rpc/internal/db/db.go b/cmd/soroban-rpc/internal/db/db.go index ccdf5c14..f41aeff6 100644 --- a/cmd/soroban-rpc/internal/db/db.go +++ b/cmd/soroban-rpc/internal/db/db.go @@ -163,11 +163,11 @@ type ReadWriterMetrics struct { } type readWriter struct { - log *log.Entry - db *DB - maxBatchSize int - ledgerRetentionWindow uint32 - passphrase string + log *log.Entry + db *DB + maxBatchSize int + historyRetentionWindow uint32 + passphrase string metrics ReadWriterMetrics } @@ -181,7 +181,7 @@ func NewReadWriter( db *DB, daemon interfaces.Daemon, maxBatchSize int, - ledgerRetentionWindow uint32, + historyRetentionWindow uint32, networkPassphrase string, ) ReadWriter { // a metric for measuring latency of transaction store operations @@ -203,11 +203,11 @@ func NewReadWriter( daemon.MetricsRegistry().MustRegister(txDurationMetric, txCountMetric) return &readWriter{ - log: log, - db: db, - maxBatchSize: maxBatchSize, - ledgerRetentionWindow: ledgerRetentionWindow, - passphrase: networkPassphrase, + log: log, + db: db, + maxBatchSize: maxBatchSize, + historyRetentionWindow: historyRetentionWindow, + passphrase: networkPassphrase, metrics: ReadWriterMetrics{ TxIngestDuration: txDurationMetric.With(prometheus.Labels{"operation": "ingest"}), TxCount: txCountMetric, @@ -234,10 +234,10 @@ func (rw *readWriter) NewTx(ctx context.Context) (WriteTx, error) { _, err := db.ExecRaw(ctx, "PRAGMA wal_checkpoint(TRUNCATE)") return err }, - tx: txSession, - stmtCache: stmtCache, - ledgerRetentionWindow: rw.ledgerRetentionWindow, - ledgerWriter: ledgerWriter{stmtCache: stmtCache}, + tx: txSession, + stmtCache: stmtCache, + historyRetentionWindow: rw.historyRetentionWindow, + ledgerWriter: ledgerWriter{stmtCache: stmtCache}, ledgerEntryWriter: ledgerEntryWriter{ stmtCache: stmtCache, buffer: xdr.NewEncodingBuffer(), @@ -266,15 +266,15 @@ func (rw *readWriter) NewTx(ctx context.Context) (WriteTx, error) { } type writeTx struct { - globalCache *dbCache - postCommit func() error - tx db.SessionInterface - stmtCache *sq.StmtCache - ledgerEntryWriter ledgerEntryWriter - ledgerWriter ledgerWriter - txWriter transactionHandler - eventWriter eventHandler - ledgerRetentionWindow uint32 + globalCache *dbCache + postCommit func() error + tx db.SessionInterface + stmtCache *sq.StmtCache + ledgerEntryWriter ledgerEntryWriter + ledgerWriter ledgerWriter + txWriter transactionHandler + eventWriter eventHandler + historyRetentionWindow uint32 } func (w writeTx) LedgerEntryWriter() LedgerEntryWriter { @@ -298,14 +298,14 @@ func (w writeTx) Commit(ledgerSeq uint32) error { return err } - if err := w.ledgerWriter.trimLedgers(ledgerSeq, w.ledgerRetentionWindow); err != nil { + if err := w.ledgerWriter.trimLedgers(ledgerSeq, w.historyRetentionWindow); err != nil { return err } - if err := w.txWriter.trimTransactions(ledgerSeq, w.ledgerRetentionWindow); err != nil { + if err := w.txWriter.trimTransactions(ledgerSeq, w.historyRetentionWindow); err != nil { return err } - if err := w.eventWriter.trimEvents(ledgerSeq, w.ledgerRetentionWindow); err != nil { + if err := w.eventWriter.trimEvents(ledgerSeq, w.historyRetentionWindow); err != nil { return err } From 7432f9761c741dbab1bf49f2fbd5a6ed62cd41ff Mon Sep 17 00:00:00 2001 From: George Date: Thu, 12 Sep 2024 12:52:37 -0700 Subject: [PATCH 11/19] Update commits to try to point to the same XDRs --- Cargo.lock | 58 +++++++++++++++++------- Cargo.toml | 9 ++-- go.mod | 48 ++++++++++---------- go.sum | 128 ++++++++++++++++++++++++++--------------------------- 4 files changed, 137 insertions(+), 106 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4c50e264..55b593a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -276,6 +276,12 @@ dependencies = [ "syn", ] +[[package]] +name = "data-encoding" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" + [[package]] name = "der" version = "0.7.8" @@ -988,7 +994,7 @@ dependencies = [ [[package]] name = "soroban-builtin-sdk-macros" version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4#4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4" +source = "git+https://github.com/stellar/rs-soroban-env?rev=75b782119942a4c8be8003f2901db38b30b6db2d#75b782119942a4c8be8003f2901db38b30b6db2d" dependencies = [ "itertools", "proc-macro2", @@ -1017,7 +1023,7 @@ dependencies = [ [[package]] name = "soroban-env-common" version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4#4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4" +source = "git+https://github.com/stellar/rs-soroban-env?rev=75b782119942a4c8be8003f2901db38b30b6db2d#75b782119942a4c8be8003f2901db38b30b6db2d" dependencies = [ "arbitrary", "crate-git-revision", @@ -1027,7 +1033,7 @@ dependencies = [ "soroban-env-macros 22.0.0", "soroban-wasmi 0.36.0-soroban.22.0.0", "static_assertions", - "stellar-xdr 22.0.0", + "stellar-xdr 22.0.0 (git+https://github.com/stellar/rs-stellar-xdr?rev=39d7dbb0c12bd422ee43a6e2e3277789da4eaac8)", "wasmparser", ] @@ -1060,14 +1066,14 @@ dependencies = [ "soroban-env-common 21.2.0", "soroban-wasmi 0.31.1-soroban.20.0.1", "static_assertions", - "stellar-strkey", + "stellar-strkey 0.0.8", "wasmparser", ] [[package]] name = "soroban-env-host" version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4#4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4" +source = "git+https://github.com/stellar/rs-soroban-env?rev=75b782119942a4c8be8003f2901db38b30b6db2d#75b782119942a4c8be8003f2901db38b30b6db2d" dependencies = [ "backtrace", "curve25519-dalek", @@ -1092,7 +1098,7 @@ dependencies = [ "soroban-env-common 22.0.0", "soroban-wasmi 0.36.0-soroban.22.0.0", "static_assertions", - "stellar-strkey", + "stellar-strkey 0.0.8", "wasmparser", ] @@ -1114,14 +1120,14 @@ dependencies = [ [[package]] name = "soroban-env-macros" version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4#4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4" +source = "git+https://github.com/stellar/rs-soroban-env?rev=75b782119942a4c8be8003f2901db38b30b6db2d#75b782119942a4c8be8003f2901db38b30b6db2d" dependencies = [ "itertools", "proc-macro2", "quote", "serde", "serde_json", - "stellar-xdr 22.0.0", + "stellar-xdr 22.0.0 (git+https://github.com/stellar/rs-stellar-xdr?rev=39d7dbb0c12bd422ee43a6e2e3277789da4eaac8)", "syn", ] @@ -1141,7 +1147,7 @@ dependencies = [ [[package]] name = "soroban-simulation" version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4#4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4" +source = "git+https://github.com/stellar/rs-soroban-env?rev=75b782119942a4c8be8003f2901db38b30b6db2d#75b782119942a4c8be8003f2901db38b30b6db2d" dependencies = [ "anyhow", "rand", @@ -1212,6 +1218,17 @@ dependencies = [ "thiserror", ] +[[package]] +name = "stellar-strkey" +version = "0.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e3aa3ed00e70082cb43febc1c2afa5056b9bb3e348bbb43d0cd0aa88a611144" +dependencies = [ + "crate-git-revision", + "data-encoding", + "thiserror", +] + [[package]] name = "stellar-xdr" version = "21.2.0" @@ -1223,22 +1240,33 @@ dependencies = [ "crate-git-revision", "escape-bytes", "hex", - "serde", - "serde_with", - "stellar-strkey", + "stellar-strkey 0.0.8", ] [[package]] name = "stellar-xdr" version = "22.0.0" -source = "git+https://github.com/stellar/rs-stellar-xdr?rev=550743b50cd3ca5a63f03f9d7175b4cfdfd9c4ac#550743b50cd3ca5a63f03f9d7175b4cfdfd9c4ac" +source = "git+https://github.com/stellar/rs-stellar-xdr?rev=39d7dbb0c12bd422ee43a6e2e3277789da4eaac8#39d7dbb0c12bd422ee43a6e2e3277789da4eaac8" dependencies = [ "arbitrary", "base64 0.13.1", "crate-git-revision", "escape-bytes", "hex", - "stellar-strkey", + "stellar-strkey 0.0.8", +] + +[[package]] +name = "stellar-xdr" +version = "22.0.0" +source = "git+https://github.com/stellar/rs-stellar-xdr.git?rev=5315f4c583784860c0accbb8d3bd234055a19751#5315f4c583784860c0accbb8d3bd234055a19751" +dependencies = [ + "crate-git-revision", + "escape-bytes", + "hex", + "serde", + "serde_with", + "stellar-strkey 0.0.9", ] [[package]] @@ -1546,7 +1574,7 @@ dependencies = [ "rand", "serde_json", "sha2", - "stellar-xdr 21.2.0", + "stellar-xdr 22.0.0 (git+https://github.com/stellar/rs-stellar-xdr.git?rev=5315f4c583784860c0accbb8d3bd234055a19751)", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index e80016ac..66956765 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ members = [ [workspace.package] rust-version = "1.74.0" + [workspace.dependencies.soroban-env-host-prev] package = "soroban-env-host" version = "=21.2.0" @@ -16,7 +17,7 @@ version = "=21.2.0" package = "soroban-env-host" version = "=22.0.0" git = "https://github.com/stellar/rs-soroban-env" -rev = "4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4" +rev = "75b782119942a4c8be8003f2901db38b30b6db2d" [workspace.dependencies.soroban-simulation-prev] package = "soroban-simulation" @@ -26,10 +27,12 @@ version = "=21.2.0" package = "soroban-simulation" version = "=22.0.0" git = "https://github.com/stellar/rs-soroban-env" -rev = "4b366a38798a84ca0ca4dde2aaef5ffdcc1cc4a4" +rev = "75b782119942a4c8be8003f2901db38b30b6db2d" [workspace.dependencies.stellar-xdr] -version = "=21.2.0" +version = "=22.0.0" +git = "https://github.com/stellar/rs-stellar-xdr.git" +rev = "5315f4c583784860c0accbb8d3bd234055a19751" features = [ "serde" ] [workspace.dependencies] diff --git a/go.mod b/go.mod index c604919d..648ea3db 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ toolchain go1.22.1 require ( github.com/Masterminds/squirrel v1.5.4 - github.com/cenkalti/backoff/v4 v4.2.1 + github.com/cenkalti/backoff/v4 v4.3.0 github.com/creachadair/jrpc2 v1.2.0 github.com/go-chi/chi v4.1.2+incompatible github.com/mattn/go-sqlite3 v1.14.17 @@ -18,17 +18,17 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 - github.com/stellar/go v0.0.0-20240628063057-b589529f102f + github.com/stellar/go v0.0.0-20240905180041-acfaa0686213 github.com/stretchr/testify v1.9.0 ) require ( - cloud.google.com/go v0.112.2 // indirect - cloud.google.com/go/auth v0.3.0 // indirect + cloud.google.com/go v0.114.0 // indirect + cloud.google.com/go/auth v0.5.1 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect cloud.google.com/go/compute/metadata v0.3.0 // indirect cloud.google.com/go/iam v1.1.8 // indirect - cloud.google.com/go/storage v1.40.0 // indirect + cloud.google.com/go/storage v1.42.0 // indirect github.com/BurntSushi/toml v1.3.2 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect @@ -42,14 +42,14 @@ require ( github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/go-errors/errors v1.5.1 // indirect github.com/go-gorp/gorp/v3 v3.1.0 // indirect - github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/google/s2a-go v0.1.7 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect - github.com/googleapis/gax-go/v2 v2.12.3 // indirect + github.com/googleapis/gax-go/v2 v2.12.4 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect @@ -63,7 +63,7 @@ require ( github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect - github.com/pkg/errors v0.9.1 // indirect + github.com/pkg/errors v0.9.1 github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.5.0 github.com/prometheus/common v0.45.0 // indirect @@ -82,26 +82,26 @@ require ( go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect - go.opentelemetry.io/otel v1.24.0 // indirect - go.opentelemetry.io/otel/metric v1.24.0 // indirect - go.opentelemetry.io/otel/trace v1.24.0 // indirect + go.opentelemetry.io/otel v1.28.0 // indirect + go.opentelemetry.io/otel/metric v1.28.0 // indirect + go.opentelemetry.io/otel/trace v1.28.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.22.0 // indirect + golang.org/x/crypto v0.24.0 // indirect golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect - golang.org/x/mod v0.13.0 // indirect - golang.org/x/net v0.24.0 // indirect - golang.org/x/oauth2 v0.20.0 // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/net v0.26.0 // indirect + golang.org/x/oauth2 v0.21.0 // indirect golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.19.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/text v0.16.0 // indirect golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.14.0 // indirect - google.golang.org/api v0.177.0 // indirect - google.golang.org/genproto v0.0.0-20240401170217-c3f982113cda // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240429193739-8cf5692501f6 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6 // indirect - google.golang.org/grpc v1.63.2 // indirect - google.golang.org/protobuf v1.34.1 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + google.golang.org/api v0.183.0 // indirect + google.golang.org/genproto v0.0.0-20240528184218-531527333157 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect + google.golang.org/grpc v1.64.0 // indirect + google.golang.org/protobuf v1.34.2 // indirect gopkg.in/djherbis/atime.v1 v1.0.0 // indirect gopkg.in/djherbis/stream.v1 v1.3.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/go.sum b/go.sum index ac3ba4e5..592db51d 100644 --- a/go.sum +++ b/go.sum @@ -17,10 +17,10 @@ cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHOb cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= -cloud.google.com/go v0.112.2 h1:ZaGT6LiG7dBzi6zNOvVZwacaXlmf3lRqnC4DQzqyRQw= -cloud.google.com/go v0.112.2/go.mod h1:iEqjp//KquGIJV/m+Pk3xecgKNhV+ry+vVTsy4TbDms= -cloud.google.com/go/auth v0.3.0 h1:PRyzEpGfx/Z9e8+lHsbkoUVXD0gnu4MNmm7Gp8TQNIs= -cloud.google.com/go/auth v0.3.0/go.mod h1:lBv6NKTWp8E3LPzmO1TbiiRKc4drLOfHsgmlH9ogv5w= +cloud.google.com/go v0.114.0 h1:OIPFAdfrFDFO2ve2U7r/H5SwSbBzEdrBdE7xkgwc+kY= +cloud.google.com/go v0.114.0/go.mod h1:ZV9La5YYxctro1HTPug5lXH/GefROyW8PPD4T8n9J8E= +cloud.google.com/go/auth v0.5.1 h1:0QNO7VThG54LUzKiQxv8C6x1YX7lUrzlAa1nVLF8CIw= +cloud.google.com/go/auth v0.5.1/go.mod h1:vbZT8GjzDf3AVqCcQmqeeM32U9HBFc32vVVAbwDsa6s= cloud.google.com/go/auth/oauth2adapt v0.2.2 h1:+TTV8aXpjeChS9M+aTtN/TjdQnzJvmzKFt//oWu7HX4= cloud.google.com/go/auth/oauth2adapt v0.2.2/go.mod h1:wcYjgpZI9+Yu7LyYBg4pqSiaRkfEK3GQcpb7C/uyF1Q= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= @@ -35,20 +35,22 @@ cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7 cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/iam v1.1.8 h1:r7umDwhj+BQyz0ScZMp4QrGXjSTI3ZINnpgU2nlB/K0= cloud.google.com/go/iam v1.1.8/go.mod h1:GvE6lyMmfxXauzNq8NbgJbeVQNspG+tcdL/W8QO1+zE= +cloud.google.com/go/longrunning v0.5.7 h1:WLbHekDbjK1fVFD3ibpFFVoyizlLRl73I7YKuAKilhU= +cloud.google.com/go/longrunning v0.5.7/go.mod h1:8GClkudohy1Fxm3owmBGid8W0pSgodEMwEAztp38Xng= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/pubsub v1.37.0 h1:0uEEfaB1VIJzabPpwpZf44zWAKAme3zwKKxHk7vJQxQ= -cloud.google.com/go/pubsub v1.37.0/go.mod h1:YQOQr1uiUM092EXwKs56OPT650nwnawc+8/IjoUeGzQ= +cloud.google.com/go/pubsub v1.38.0 h1:J1OT7h51ifATIedjqk/uBNPh+1hkvUaH4VKbz4UuAsc= +cloud.google.com/go/pubsub v1.38.0/go.mod h1:IPMJSWSus/cu57UyR01Jqa/bNOQA+XnPF6Z4dKW4fAA= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cloud.google.com/go/storage v1.40.0 h1:VEpDQV5CJxFmJ6ueWNsKxcr1QAYOXEgxDa+sBbJahPw= -cloud.google.com/go/storage v1.40.0/go.mod h1:Rrj7/hKlG87BLqDJYtwR0fbPld8uJPbQ2ucUMY7Ir0g= +cloud.google.com/go/storage v1.42.0 h1:4QtGpplCVt1wz6g5o1ifXd656P5z+yNgzdw1tVfp0cU= +cloud.google.com/go/storage v1.42.0/go.mod h1:HjMXRFq65pGKFn6hxj6x3HCyR41uSB72Z0SO/Vn6JFQ= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= @@ -68,8 +70,8 @@ github.com/aws/aws-sdk-go v1.45.27 h1:b+zOTPkAG4i2RvqPdHxkJZafmhhVaVHBp4r41Tu4I6 github.com/aws/aws-sdk-go v1.45.27/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= -github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -107,8 +109,8 @@ github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0X github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -github.com/fsouza/fake-gcs-server v1.49.0 h1:4x1RxKuqoqhZrXogtj5nInQnIjQylxld43tKrkPHnmE= -github.com/fsouza/fake-gcs-server v1.49.0/go.mod h1:FJYZxdHQk2nGxrczFjLbDv8h6SnYXxSxcnM14eeespA= +github.com/fsouza/fake-gcs-server v1.49.2 h1:fukDqzEQM50QkA0jAbl6cLqeDu3maQjwZBuys759TR4= +github.com/fsouza/fake-gcs-server v1.49.2/go.mod h1:17SYzJEXRcaAA5ATwwvgBkSIqIy7r1icnGM0y/y4foY= github.com/gavv/monotime v0.0.0-20161010190848-47d58efa6955 h1:gmtGRvSexPU4B1T/yYo0sLOKzER1YT+b4kPxPpm0Ty4= github.com/gavv/monotime v0.0.0-20161010190848-47d58efa6955/go.mod h1:vmp8DIyckQMXOPl0AQVHt+7n5h7Gb7hS6CUydiV8QeA= github.com/go-chi/chi v4.1.2+incompatible h1:fGFk2Gmi/YKXk0OmGfBh0WgmN3XB8lVnEyNz34tQRec= @@ -121,8 +123,8 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2 github.com/go-gorp/gorp/v3 v3.1.0 h1:ItKF/Vbuj31dmV4jxA1qblpSwkl9g1typ24xoe70IGs= github.com/go-gorp/gorp/v3 v3.1.0/go.mod h1:dLEjIyyRNiXvNZ8PSmzpt1GsWAUK8kjVhEpjH8TixEw= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= @@ -182,8 +184,8 @@ github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPg github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= -github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= +github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc= +github.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= @@ -207,8 +209,8 @@ github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfF github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.12.3 h1:5/zPPDvw8Q1SuXjrqrZslrqT7dL/uJT2CQii/cLCKqA= -github.com/googleapis/gax-go/v2 v2.12.3/go.mod h1:AKloxT6GtNbaLm8QTNSidHUVsHYcBHwWRvkNFJUQcS4= +github.com/googleapis/gax-go/v2 v2.12.4 h1:9gWcmF85Wvq4ryPFvGFaOgPIs1AQX0d0bcbGw4Z96qg= +github.com/googleapis/gax-go/v2 v2.12.4/go.mod h1:KYEYLorsnIGDi/rPC8b5TdlB9kbKoFubselGIoBMCwI= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= @@ -340,10 +342,8 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI= -github.com/stellar/go v0.0.0-20240617183518-100dc4fa6043 h1:5UQzsvt9VtD3ijpzPtdW0/lXWCNgDs6GzmLUE8ZuWfk= -github.com/stellar/go v0.0.0-20240617183518-100dc4fa6043/go.mod h1:TuXKLL7WViqwrvpWno2I4UYGn2Ny9KZld1jUIN6fnK8= -github.com/stellar/go v0.0.0-20240628063057-b589529f102f h1:3W9JZJ0r87wy2M3wsACuJtKW/cNWXpfw5Jwyt89Am30= -github.com/stellar/go v0.0.0-20240628063057-b589529f102f/go.mod h1:4cVjIVyU8V1iSBEMGd41j22DAyBoz2SVL5TcrJPqePU= +github.com/stellar/go v0.0.0-20240905180041-acfaa0686213 h1:224VUCwV1xmmeTru1zCmTHxvi2RECoHdfdWgd9ni518= +github.com/stellar/go v0.0.0-20240905180041-acfaa0686213/go.mod h1:rrFK7a8i2h9xad9HTfnSN/dTNEqXVHKAbkFeR7UxAgs= github.com/stellar/go-xdr v0.0.0-20231122183749-b53fb00bcac2 h1:OzCVd0SV5qE3ZcDeSFCmOWLZfEWZ3Oe8KtmSOYKEVWE= github.com/stellar/go-xdr v0.0.0-20231122183749-b53fb00bcac2/go.mod h1:yoxyU/M8nl9LKeWIoBrbDPQ7Cy+4jxRcWcOayZ4BMps= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -369,12 +369,12 @@ github.com/valyala/fasthttp v1.34.0 h1:d3AAQJ2DRcxJYHm7OXNXtXt2as1vMDfxeIcFvhmGG github.com/valyala/fasthttp v1.34.0/go.mod h1:epZA5N+7pY6ZaEKRmstzOuYJx9HI8DI1oaCGZpdH4h0= github.com/xdrpp/goxdr v0.1.1 h1:E1B2c6E8eYhOVyd7yEpOyopzTPirUeF6mVOfXfGyJyc= github.com/xdrpp/goxdr v0.1.1/go.mod h1:dXo1scL/l6s7iME1gxHWo2XCppbHEKZS7m/KyYWkNzA= -github.com/xeipuuv/gojsonpointer v0.0.0-20151027082146-e0fe6f683076 h1:KM4T3G70MiR+JtqplcYkNVoNz7pDwYaBxWBXQK804So= -github.com/xeipuuv/gojsonpointer v0.0.0-20151027082146-e0fe6f683076/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonreference v0.0.0-20150808065054-e02fc20de94c h1:XZWnr3bsDQWAZg4Ne+cPoXRPILrNlPNQfxBuwLl43is= -github.com/xeipuuv/gojsonreference v0.0.0-20150808065054-e02fc20de94c/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= -github.com/xeipuuv/gojsonschema v0.0.0-20161231055540-f06f290571ce h1:cVSRGH8cOveJNwFEEZLXtB+XMnRqKLjUP6V/ZFYQCXI= -github.com/xeipuuv/gojsonschema v0.0.0-20161231055540-f06f290571ce/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/yalp/jsonpath v0.0.0-20150812003900-31a79c7593bb h1:06WAhQa+mYv7BiOk13B/ywyTlkoE/S7uu6TBKU6FHnE= github.com/yalp/jsonpath v0.0.0-20150812003900-31a79c7593bb/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI= github.com/yudai/gojsondiff v0.0.0-20170107030110-7b1b7adf999d h1:yJIizrfO599ot2kQ6Af1enICnwBD3XoxgX3MrMwot2M= @@ -398,14 +398,14 @@ go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.4 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= -go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= -go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= -go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= -go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= -go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= -go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= -go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= -go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= +go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= +go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= +go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= +go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= +go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= +go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= +go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -416,8 +416,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= -golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= +golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -454,8 +454,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= -golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -491,8 +491,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -502,8 +502,8 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo= -golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= +golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -557,13 +557,13 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= -golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= -golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= +golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= +golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -573,8 +573,8 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -628,8 +628,8 @@ golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= -golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -655,8 +655,8 @@ google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz513 google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.177.0 h1:8a0p/BbPa65GlqGWtUKxot4p0TV8OGOfyTjtmkXNXmk= -google.golang.org/api v0.177.0/go.mod h1:srbhue4MLjkjbkux5p3dw/ocYOSZTaIEvf7bCOnFQDw= +google.golang.org/api v0.183.0 h1:PNMeRDwo1pJdgNcFQ9GstuLe/noWKIc89pRWRLMvLwE= +google.golang.org/api v0.183.0/go.mod h1:q43adC5/pHoSZTx5h2mSmdF7NcyfW9JuDyIOJAgS9ZQ= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -700,12 +700,12 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20240401170217-c3f982113cda h1:wu/KJm9KJwpfHWhkkZGohVC6KRrc1oJNr4jwtQMOQXw= -google.golang.org/genproto v0.0.0-20240401170217-c3f982113cda/go.mod h1:g2LLCvCeCSir/JJSWosk19BR4NVxGqHUC6rxIRsd7Aw= -google.golang.org/genproto/googleapis/api v0.0.0-20240429193739-8cf5692501f6 h1:DTJM0R8LECCgFeUwApvcEJHz85HLagW8uRENYxHh1ww= -google.golang.org/genproto/googleapis/api v0.0.0-20240429193739-8cf5692501f6/go.mod h1:10yRODfgim2/T8csjQsMPgZOMvtytXKTDRzH6HRGzRw= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6 h1:DujSIu+2tC9Ht0aPNA7jgj23Iq8Ewi5sgkQ++wdvonE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= +google.golang.org/genproto v0.0.0-20240528184218-531527333157 h1:u7WMYrIrVvs0TF5yaKwKNbcJyySYf+HAIFXxWltJOXE= +google.golang.org/genproto v0.0.0-20240528184218-531527333157/go.mod h1:ubQlAQnzejB8uZzszhrTCU2Fyp6Vi7ZE5nn0c3W8+qQ= +google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 h1:0+ozOGcrp+Y8Aq8TLNN2Aliibms5LEzsq99ZZmAGYm0= +google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094/go.mod h1:fJ/e3If/Q67Mj99hin0hMhiNyCRmt6BQ2aWIJshUSJw= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -722,8 +722,8 @@ google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= -google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= +google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= +google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -734,8 +734,8 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From b8177505d3dc7f8f5c1b7a4121bd4df706667db9 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Fri, 20 Sep 2024 14:56:14 +0200 Subject: [PATCH 12/19] simulate-transaction: remove confusing Cost field in response (#295) * simulate-transaction: remove confusing Cost field in response * Appease linter --- .../simulate_transaction_test.go | 2 -- .../internal/methods/simulate_transaction.go | 21 +++++-------------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/cmd/soroban-rpc/internal/integrationtest/simulate_transaction_test.go b/cmd/soroban-rpc/internal/integrationtest/simulate_transaction_test.go index 25573778..650c8349 100644 --- a/cmd/soroban-rpc/internal/integrationtest/simulate_transaction_test.go +++ b/cmd/soroban-rpc/internal/integrationtest/simulate_transaction_test.go @@ -32,8 +32,6 @@ func TestSimulateTransactionSucceeds(t *testing.T) { contractHashBytes := xdr.ScBytes(contractHash[:]) expectedXdr := xdr.ScVal{Type: xdr.ScValTypeScvBytes, Bytes: &contractHashBytes} require.Greater(t, result.LatestLedger, uint32(0)) - require.Greater(t, result.Cost.CPUInstructions, uint64(0)) - require.Greater(t, result.Cost.MemoryBytes, uint64(0)) expectedTransactionData := xdr.SorobanTransactionData{ Resources: xdr.SorobanResources{ diff --git a/cmd/soroban-rpc/internal/methods/simulate_transaction.go b/cmd/soroban-rpc/internal/methods/simulate_transaction.go index 22868414..7e8a3e6d 100644 --- a/cmd/soroban-rpc/internal/methods/simulate_transaction.go +++ b/cmd/soroban-rpc/internal/methods/simulate_transaction.go @@ -25,13 +25,8 @@ type SimulateTransactionRequest struct { Format string `json:"xdrFormat,omitempty"` } -type SimulateTransactionCost struct { - CPUInstructions uint64 `json:"cpuInsns,string"` - MemoryBytes uint64 `json:"memBytes,string"` -} - -// SimulateHostFunctionResult contains the simulation result of each HostFunction -// within the single InvokeHostFunctionOp allowed in a Transaction +// SimulateHostFunctionResult contains the simulation result of each HostFunction within the single +// InvokeHostFunctionOp allowed in a Transaction type SimulateHostFunctionResult struct { AuthXDR *[]string `json:"auth,omitempty"` AuthJSON []json.RawMessage `json:"authJson,omitempty"` @@ -217,8 +212,6 @@ type SimulateTransactionResponse struct { MinResourceFee int64 `json:"minResourceFee,string,omitempty"` // an array of the individual host function call results Results []SimulateHostFunctionResult `json:"results,omitempty"` - // the effective cpu and memory cost of the invoked transaction execution. - Cost SimulateTransactionCost `json:"cost,omitempty"` // If present, it indicates that a prior RestoreFootprint is required RestorePreamble *RestorePreamble `json:"restorePreamble,omitempty"` // If present, it indicates how the state (ledger entries) will change as a result of the transaction execution. @@ -392,13 +385,9 @@ func NewSimulateTransactionHandler(logger *log.Entry, ledgerEntryReader db.Ledge } simResp := SimulateTransactionResponse{ - Error: result.Error, - Results: results, - MinResourceFee: result.MinFee, - Cost: SimulateTransactionCost{ - CPUInstructions: result.CPUInstructions, - MemoryBytes: result.MemoryBytes, - }, + Error: result.Error, + Results: results, + MinResourceFee: result.MinFee, LatestLedger: latestLedger, RestorePreamble: restorePreamble, StateChanges: stateChanges, From cfcf61bb00dbd08449c798dbd32a2c48eca55cc5 Mon Sep 17 00:00:00 2001 From: George Date: Tue, 24 Sep 2024 10:00:30 -0700 Subject: [PATCH 13/19] Point all dependencies at the same XDR revisions --- .github/workflows/e2e.yml | 2 +- .github/workflows/soroban-rpc.yml | 12 +- Cargo.lock | 257 +++++++++++++++++++++++++----- Cargo.toml | 6 +- go.mod | 2 +- go.sum | 2 + 6 files changed, 230 insertions(+), 51 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index fb492f0c..bdfd362c 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -31,7 +31,7 @@ jobs: SYSTEM_TEST_CORE_COMPILE_CONFIGURE_FLAGS: "--disable-tests" # or set SYSTEM_TEST_CORE_GIT_REF to empty, and set SYSTEM_TEST_CORE_IMAGE # to pull a pre-compiled image from dockerhub instead - SYSTEM_TEST_CORE_IMAGE: stellar/stellar-core:20 + SYSTEM_TEST_CORE_IMAGE: stellar/stellar-core:21 SYSTEM_TEST_CORE_IMAGE_BIN_PATH: /usr/bin/stellar-core # sets the version of rust toolchain that will be pre-installed in the diff --git a/.github/workflows/soroban-rpc.yml b/.github/workflows/soroban-rpc.yml index bc7ed064..93616c00 100644 --- a/.github/workflows/soroban-rpc.yml +++ b/.github/workflows/soroban-rpc.yml @@ -98,16 +98,18 @@ jobs: strategy: matrix: os: [ ubuntu-20.04, ubuntu-22.04 ] - protocol-version: [ 20, 21 ] + protocol-version: [ 21, 22 ] runs-on: ${{ matrix.os }} env: SOROBAN_RPC_INTEGRATION_TESTS_ENABLED: true SOROBAN_RPC_INTEGRATION_TESTS_CORE_MAX_SUPPORTED_PROTOCOL: ${{ matrix.protocol-version }} SOROBAN_RPC_INTEGRATION_TESTS_CAPTIVE_CORE_BIN: /usr/bin/stellar-core - PROTOCOL_20_CORE_DEBIAN_PKG_VERSION: 21.1.0-1909.rc1.b3aeb14cc.focal - PROTOCOL_20_CORE_DOCKER_IMG: stellar/stellar-core:21.1.0-1909.rc1.b3aeb14cc.focal - PROTOCOL_21_CORE_DEBIAN_PKG_VERSION: 21.1.0-1909.rc1.b3aeb14cc.focal - PROTOCOL_21_CORE_DOCKER_IMG: stellar/stellar-core:21.1.0-1909.rc1.b3aeb14cc.focal + PROTOCOL_21_CORE_DEBIAN_PKG_VERSION: 21.3.1-2007.4ede19620.focal + PROTOCOL_21_CORE_DOCKER_IMG: stellar/stellar-core:21.3.1-2007.4ede19620.focal + # TODO: Update these to P22 builds once releases kick off. + PROTOCOL_22_CORE_DEBIAN_PKG_VERSION: 21.3.1-2007.4ede19620.focal + PROTOCOL_22_CORE_DOCKER_IMG: stellar/stellar-core:21.3.1-2007.4ede19620.focal + steps: - uses: actions/checkout@v4 with: diff --git a/Cargo.lock b/Cargo.lock index 55b593a6..f725d384 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -59,6 +59,124 @@ dependencies = [ "derive_arbitrary", ] +[[package]] +name = "ark-bls12-381" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c775f0d12169cba7aae4caeb547bb6a50781c7449a8aa53793827c9ec4abf488" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-serialize", + "ark-std", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", + "itertools 0.10.5", + "num-traits", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "derivative", + "digest", + "itertools 0.10.5", + "num-bigint", + "num-traits", + "paste", + "rustc_version", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive", + "ark-std", + "digest", + "num-bigint", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + [[package]] name = "arrayvec" version = "0.7.4" @@ -238,7 +356,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -262,7 +380,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn", + "syn 2.0.39", ] [[package]] @@ -273,7 +391,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -302,6 +420,17 @@ dependencies = [ "serde", ] +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "derive_arbitrary" version = "1.3.2" @@ -310,7 +439,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -486,6 +615,15 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + [[package]] name = "hashbrown" version = "0.14.3" @@ -576,6 +714,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.11.0" @@ -660,6 +807,17 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "685a9ac4b61f4e728e1d2c6a7844609c16527aeb5e6c865915c08e619c16410f" +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-conv" version = "0.1.0" @@ -674,7 +832,7 @@ checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -898,7 +1056,7 @@ checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -939,7 +1097,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -985,21 +1143,21 @@ version = "21.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44877373b3dc6c662377cb1600e3a62706d75e484b6064f9cd22e467c676b159" dependencies = [ - "itertools", + "itertools 0.11.0", "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] name = "soroban-builtin-sdk-macros" version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=75b782119942a4c8be8003f2901db38b30b6db2d#75b782119942a4c8be8003f2901db38b30b6db2d" +source = "git+https://github.com/stellar/rs-soroban-env?rev=0497816694bef2b103494c8c61b7c8a06a72c7d3#0497816694bef2b103494c8c61b7c8a06a72c7d3" dependencies = [ - "itertools", + "itertools 0.10.5", "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -1023,7 +1181,7 @@ dependencies = [ [[package]] name = "soroban-env-common" version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=75b782119942a4c8be8003f2901db38b30b6db2d#75b782119942a4c8be8003f2901db38b30b6db2d" +source = "git+https://github.com/stellar/rs-soroban-env?rev=0497816694bef2b103494c8c61b7c8a06a72c7d3#0497816694bef2b103494c8c61b7c8a06a72c7d3" dependencies = [ "arbitrary", "crate-git-revision", @@ -1033,7 +1191,7 @@ dependencies = [ "soroban-env-macros 22.0.0", "soroban-wasmi 0.36.0-soroban.22.0.0", "static_assertions", - "stellar-xdr 22.0.0 (git+https://github.com/stellar/rs-stellar-xdr?rev=39d7dbb0c12bd422ee43a6e2e3277789da4eaac8)", + "stellar-xdr 22.0.0", "wasmparser", ] @@ -1073,9 +1231,12 @@ dependencies = [ [[package]] name = "soroban-env-host" version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=75b782119942a4c8be8003f2901db38b30b6db2d#75b782119942a4c8be8003f2901db38b30b6db2d" +source = "git+https://github.com/stellar/rs-soroban-env?rev=0497816694bef2b103494c8c61b7c8a06a72c7d3#0497816694bef2b103494c8c61b7c8a06a72c7d3" dependencies = [ - "backtrace", + "ark-bls12-381", + "ark-ec", + "ark-ff", + "ark-serialize", "curve25519-dalek", "ecdsa", "ed25519-dalek", @@ -1098,7 +1259,7 @@ dependencies = [ "soroban-env-common 22.0.0", "soroban-wasmi 0.36.0-soroban.22.0.0", "static_assertions", - "stellar-strkey 0.0.8", + "stellar-strkey 0.0.9", "wasmparser", ] @@ -1108,27 +1269,27 @@ version = "21.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e16b761459fdf3c4b62b24df3941498d14e5246e6fadfb4774ed8114d243aa4" dependencies = [ - "itertools", + "itertools 0.11.0", "proc-macro2", "quote", "serde", "serde_json", "stellar-xdr 21.2.0", - "syn", + "syn 2.0.39", ] [[package]] name = "soroban-env-macros" version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=75b782119942a4c8be8003f2901db38b30b6db2d#75b782119942a4c8be8003f2901db38b30b6db2d" +source = "git+https://github.com/stellar/rs-soroban-env?rev=0497816694bef2b103494c8c61b7c8a06a72c7d3#0497816694bef2b103494c8c61b7c8a06a72c7d3" dependencies = [ - "itertools", + "itertools 0.10.5", "proc-macro2", "quote", "serde", "serde_json", - "stellar-xdr 22.0.0 (git+https://github.com/stellar/rs-stellar-xdr?rev=39d7dbb0c12bd422ee43a6e2e3277789da4eaac8)", - "syn", + "stellar-xdr 22.0.0", + "syn 2.0.39", ] [[package]] @@ -1147,7 +1308,7 @@ dependencies = [ [[package]] name = "soroban-simulation" version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=75b782119942a4c8be8003f2901db38b30b6db2d#75b782119942a4c8be8003f2901db38b30b6db2d" +source = "git+https://github.com/stellar/rs-soroban-env?rev=0497816694bef2b103494c8c61b7c8a06a72c7d3#0497816694bef2b103494c8c61b7c8a06a72c7d3" dependencies = [ "anyhow", "rand", @@ -1246,21 +1407,10 @@ dependencies = [ [[package]] name = "stellar-xdr" version = "22.0.0" -source = "git+https://github.com/stellar/rs-stellar-xdr?rev=39d7dbb0c12bd422ee43a6e2e3277789da4eaac8#39d7dbb0c12bd422ee43a6e2e3277789da4eaac8" +source = "git+https://github.com/stellar/rs-stellar-xdr.git?rev=b5516843b6379e4e29520bf2ba156484f62edc46#b5516843b6379e4e29520bf2ba156484f62edc46" dependencies = [ "arbitrary", "base64 0.13.1", - "crate-git-revision", - "escape-bytes", - "hex", - "stellar-strkey 0.0.8", -] - -[[package]] -name = "stellar-xdr" -version = "22.0.0" -source = "git+https://github.com/stellar/rs-stellar-xdr.git?rev=5315f4c583784860c0accbb8d3bd234055a19751#5315f4c583784860c0accbb8d3bd234055a19751" -dependencies = [ "crate-git-revision", "escape-bytes", "hex", @@ -1292,6 +1442,17 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.39" @@ -1320,7 +1481,7 @@ checksum = "268026685b2be38d7103e9e507c938a1fcb3d7e6eb15e87870b617bf37b6d581" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -1399,7 +1560,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 2.0.39", "wasm-bindgen-shared", ] @@ -1421,7 +1582,7 @@ checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1574,7 +1735,7 @@ dependencies = [ "rand", "serde_json", "sha2", - "stellar-xdr 22.0.0 (git+https://github.com/stellar/rs-stellar-xdr.git?rev=5315f4c583784860c0accbb8d3bd234055a19751)", + "stellar-xdr 22.0.0", ] [[package]] @@ -1594,7 +1755,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -1602,3 +1763,17 @@ name = "zeroize" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] diff --git a/Cargo.toml b/Cargo.toml index 66956765..1fa82bf8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ version = "=21.2.0" package = "soroban-env-host" version = "=22.0.0" git = "https://github.com/stellar/rs-soroban-env" -rev = "75b782119942a4c8be8003f2901db38b30b6db2d" +rev = "0497816694bef2b103494c8c61b7c8a06a72c7d3" [workspace.dependencies.soroban-simulation-prev] package = "soroban-simulation" @@ -27,12 +27,12 @@ version = "=21.2.0" package = "soroban-simulation" version = "=22.0.0" git = "https://github.com/stellar/rs-soroban-env" -rev = "75b782119942a4c8be8003f2901db38b30b6db2d" +rev = "0497816694bef2b103494c8c61b7c8a06a72c7d3" [workspace.dependencies.stellar-xdr] version = "=22.0.0" git = "https://github.com/stellar/rs-stellar-xdr.git" -rev = "5315f4c583784860c0accbb8d3bd234055a19751" +rev = "b5516843b6379e4e29520bf2ba156484f62edc46" features = [ "serde" ] [workspace.dependencies] diff --git a/go.mod b/go.mod index 648ea3db..22f1e556 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 - github.com/stellar/go v0.0.0-20240905180041-acfaa0686213 + github.com/stellar/go v0.0.0-20240924164223-4e84b645a143 github.com/stretchr/testify v1.9.0 ) diff --git a/go.sum b/go.sum index 592db51d..ef01228f 100644 --- a/go.sum +++ b/go.sum @@ -344,6 +344,8 @@ github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI= github.com/stellar/go v0.0.0-20240905180041-acfaa0686213 h1:224VUCwV1xmmeTru1zCmTHxvi2RECoHdfdWgd9ni518= github.com/stellar/go v0.0.0-20240905180041-acfaa0686213/go.mod h1:rrFK7a8i2h9xad9HTfnSN/dTNEqXVHKAbkFeR7UxAgs= +github.com/stellar/go v0.0.0-20240924164223-4e84b645a143 h1:vg8ethEGMPeUMkxTudzl2J2JtQPHwXefUpuoGy6aVsc= +github.com/stellar/go v0.0.0-20240924164223-4e84b645a143/go.mod h1:rrFK7a8i2h9xad9HTfnSN/dTNEqXVHKAbkFeR7UxAgs= github.com/stellar/go-xdr v0.0.0-20231122183749-b53fb00bcac2 h1:OzCVd0SV5qE3ZcDeSFCmOWLZfEWZ3Oe8KtmSOYKEVWE= github.com/stellar/go-xdr v0.0.0-20231122183749-b53fb00bcac2/go.mod h1:yoxyU/M8nl9LKeWIoBrbDPQ7Cy+4jxRcWcOayZ4BMps= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= From a84084e6ba562a73b59eb8ab03cf68189f76a04b Mon Sep 17 00:00:00 2001 From: George Date: Tue, 24 Sep 2024 12:36:36 -0700 Subject: [PATCH 14/19] Repoint monorepo to protocol-22 instead of PR commit --- .github/workflows/e2e.yml | 8 ++++---- go.mod | 2 +- go.sum | 6 ++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index bdfd362c..6f9910b2 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -42,7 +42,7 @@ jobs: # resolution options, using npm release or a gh ref: # # option #1, set the version of stellar-sdk based on a npm release version - SYSTEM_TEST_JS_STELLAR_SDK_NPM_VERSION: 11.3.0 + SYSTEM_TEST_JS_STELLAR_SDK_NPM_VERSION: 12.3.0 # option #2, set the version of stellar-sdk used as a ref to a gh repo if # a value is set on SYSTEM_TEST_JS_STELLAR_SDK_GH_REPO, it takes # precedence over any SYSTEM_TEST_JS_STELLAR_SDK_NPM_VERSION @@ -50,17 +50,17 @@ jobs: SYSTEM_TEST_JS_STELLAR_SDK_GH_REF: # the version of rs-stellar-xdr to use for quickstart - SYSTEM_TEST_RS_XDR_GIT_REF: v20.0.2 + SYSTEM_TEST_RS_XDR_GIT_REF: v21.2.0 # system test will build quickstart image internally to use for running the service stack # configured in standalone network mode(core, rpc) - SYSTEM_TEST_QUICKSTART_GIT_REF: https://github.com/stellar/quickstart.git#412bb828ddb4a93745227ab5ad97c623d43f3a5f + SYSTEM_TEST_QUICKSTART_GIT_REF: https://github.com/stellar/quickstart.git#ae7fdb07283a0af836d4cd51ff09b02db93fb12c # triggers system test to log out details from quickstart's logs and test steps SYSTEM_TEST_VERBOSE_OUTPUT: "true" # the soroban test cases will compile various contracts from the examples repo - SYSTEM_TEST_SOROBAN_EXAMPLES_GIT_HASH: "v20.0.0" + SYSTEM_TEST_SOROBAN_EXAMPLES_GIT_HASH: "v21.6.0" SYSTEM_TEST_SOROBAN_EXAMPLES_GIT_REPO: "https://github.com/stellar/soroban-examples.git" steps: - uses: actions/checkout@v4 diff --git a/go.mod b/go.mod index 22f1e556..e2d415f0 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 - github.com/stellar/go v0.0.0-20240924164223-4e84b645a143 + github.com/stellar/go v0.0.0-20240924182550-69667b25baf4 github.com/stretchr/testify v1.9.0 ) diff --git a/go.sum b/go.sum index ef01228f..8bc56e76 100644 --- a/go.sum +++ b/go.sum @@ -342,10 +342,8 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI= -github.com/stellar/go v0.0.0-20240905180041-acfaa0686213 h1:224VUCwV1xmmeTru1zCmTHxvi2RECoHdfdWgd9ni518= -github.com/stellar/go v0.0.0-20240905180041-acfaa0686213/go.mod h1:rrFK7a8i2h9xad9HTfnSN/dTNEqXVHKAbkFeR7UxAgs= -github.com/stellar/go v0.0.0-20240924164223-4e84b645a143 h1:vg8ethEGMPeUMkxTudzl2J2JtQPHwXefUpuoGy6aVsc= -github.com/stellar/go v0.0.0-20240924164223-4e84b645a143/go.mod h1:rrFK7a8i2h9xad9HTfnSN/dTNEqXVHKAbkFeR7UxAgs= +github.com/stellar/go v0.0.0-20240924182550-69667b25baf4 h1:Kd4ivg3hCG8AfFQpxjUjhEXKc40Ux+piUWL03dBB/sw= +github.com/stellar/go v0.0.0-20240924182550-69667b25baf4/go.mod h1:rrFK7a8i2h9xad9HTfnSN/dTNEqXVHKAbkFeR7UxAgs= github.com/stellar/go-xdr v0.0.0-20231122183749-b53fb00bcac2 h1:OzCVd0SV5qE3ZcDeSFCmOWLZfEWZ3Oe8KtmSOYKEVWE= github.com/stellar/go-xdr v0.0.0-20231122183749-b53fb00bcac2/go.mod h1:yoxyU/M8nl9LKeWIoBrbDPQ7Cy+4jxRcWcOayZ4BMps= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= From 5e18dfdfa2a01252d03a83d93174cbc1b1d9b393 Mon Sep 17 00:00:00 2001 From: George Date: Tue, 24 Sep 2024 14:50:40 -0700 Subject: [PATCH 15/19] Use different methods for getting protocol version --- cmd/soroban-rpc/lib/preflight/src/lib.rs | 13 +++++++++---- cmd/soroban-rpc/lib/preflight/src/shared.rs | 4 +--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/cmd/soroban-rpc/lib/preflight/src/lib.rs b/cmd/soroban-rpc/lib/preflight/src/lib.rs index b762db60..b12c9db3 100644 --- a/cmd/soroban-rpc/lib/preflight/src/lib.rs +++ b/cmd/soroban-rpc/lib/preflight/src/lib.rs @@ -38,6 +38,8 @@ mod curr { pub(crate) use soroban_simulation_curr as soroban_simulation; #[allow(clippy::duplicate_mod)] pub(crate) mod shared; + + pub(crate) const PROTOCOL: u32 = soroban_env_host::meta::INTERFACE_VERSION.protocol; } #[path = "."] @@ -46,6 +48,9 @@ mod prev { pub(crate) use soroban_simulation_prev as soroban_simulation; #[allow(clippy::duplicate_mod)] pub(crate) mod shared; + + pub(crate) const PROTOCOL: u32 = soroban_env_host::meta::get_ledger_protocol_version( + soroban_env_host::meta::INTERFACE_VERSION); } use std::cell::RefCell; @@ -164,7 +169,7 @@ pub extern "C" fn preflight_invoke_hf_op( ) -> *mut CPreflightResult { let proto = ledger_info.protocol_version; catch_preflight_panic(Box::new(move || { - if proto <= prev::shared::PROTOCOL { + if proto <= prev::PROTOCOL { prev::shared::preflight_invoke_hf_op_or_maybe_panic( handle, invoke_hf_op, @@ -173,7 +178,7 @@ pub extern "C" fn preflight_invoke_hf_op( resource_config, enable_debug, ) - } else if proto == curr::shared::PROTOCOL { + } else if proto == curr::PROTOCOL { curr::shared::preflight_invoke_hf_op_or_maybe_panic( handle, invoke_hf_op, @@ -197,14 +202,14 @@ pub extern "C" fn preflight_footprint_ttl_op( ) -> *mut CPreflightResult { let proto = ledger_info.protocol_version; catch_preflight_panic(Box::new(move || { - if proto <= prev::shared::PROTOCOL { + if proto <= prev::PROTOCOL { prev::shared::preflight_footprint_ttl_op_or_maybe_panic( handle, op_body, footprint, ledger_info, ) - } else if proto == curr::shared::PROTOCOL { + } else if proto == curr::PROTOCOL { curr::shared::preflight_footprint_ttl_op_or_maybe_panic( handle, op_body, diff --git a/cmd/soroban-rpc/lib/preflight/src/shared.rs b/cmd/soroban-rpc/lib/preflight/src/shared.rs index a517eadd..5a8abd4c 100644 --- a/cmd/soroban-rpc/lib/preflight/src/shared.rs +++ b/cmd/soroban-rpc/lib/preflight/src/shared.rs @@ -18,7 +18,7 @@ use super::soroban_env_host::xdr::{ LedgerFootprint, LedgerKey, LedgerKeyTtl, OperationBody, ReadXdr, ScErrorCode, ScErrorType, SorobanTransactionData, TtlEntry, WriteXdr, }; -use super::soroban_env_host::{meta, HostError, LedgerInfo, DEFAULT_XDR_RW_LIMITS}; +use super::soroban_env_host::{HostError, LedgerInfo, DEFAULT_XDR_RW_LIMITS}; use super::soroban_simulation::simulation::{ simulate_extend_ttl_op, simulate_invoke_host_function_op, simulate_restore_op, InvokeHostFunctionSimulationResult, LedgerEntryDiff, RestoreOpSimulationResult, @@ -41,8 +41,6 @@ use std::convert::TryFrom; use std::ptr::null_mut; use std::rc::Rc; -pub(crate) const PROTOCOL: u32 = meta::get_ledger_protocol_version(meta::INTERFACE_VERSION); - fn fill_ledger_info(c_ledger_info: CLedgerInfo, network_config: &NetworkConfig) -> LedgerInfo { let network_passphrase = unsafe { from_c_string(c_ledger_info.network_passphrase) }; let mut ledger_info = LedgerInfo { From 730b43dcf1b62be90fdb344c7d4c9da6feac1962 Mon Sep 17 00:00:00 2001 From: George Date: Tue, 24 Sep 2024 14:53:11 -0700 Subject: [PATCH 16/19] fmt :rolling_eyes: --- cmd/soroban-rpc/lib/preflight/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/soroban-rpc/lib/preflight/src/lib.rs b/cmd/soroban-rpc/lib/preflight/src/lib.rs index b12c9db3..fc7b0e35 100644 --- a/cmd/soroban-rpc/lib/preflight/src/lib.rs +++ b/cmd/soroban-rpc/lib/preflight/src/lib.rs @@ -50,7 +50,8 @@ mod prev { pub(crate) mod shared; pub(crate) const PROTOCOL: u32 = soroban_env_host::meta::get_ledger_protocol_version( - soroban_env_host::meta::INTERFACE_VERSION); + soroban_env_host::meta::INTERFACE_VERSION, + ); } use std::cell::RefCell; From 612532daa5988710d14ce1479f6638fe05e5648d Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Wed, 2 Oct 2024 01:44:00 +0200 Subject: [PATCH 17/19] Bump Core to v22rc1 --- .github/workflows/soroban-rpc.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/soroban-rpc.yml b/.github/workflows/soroban-rpc.yml index 93616c00..6ce8184c 100644 --- a/.github/workflows/soroban-rpc.yml +++ b/.github/workflows/soroban-rpc.yml @@ -104,11 +104,10 @@ jobs: SOROBAN_RPC_INTEGRATION_TESTS_ENABLED: true SOROBAN_RPC_INTEGRATION_TESTS_CORE_MAX_SUPPORTED_PROTOCOL: ${{ matrix.protocol-version }} SOROBAN_RPC_INTEGRATION_TESTS_CAPTIVE_CORE_BIN: /usr/bin/stellar-core - PROTOCOL_21_CORE_DEBIAN_PKG_VERSION: 21.3.1-2007.4ede19620.focal - PROTOCOL_21_CORE_DOCKER_IMG: stellar/stellar-core:21.3.1-2007.4ede19620.focal - # TODO: Update these to P22 builds once releases kick off. - PROTOCOL_22_CORE_DEBIAN_PKG_VERSION: 21.3.1-2007.4ede19620.focal - PROTOCOL_22_CORE_DOCKER_IMG: stellar/stellar-core:21.3.1-2007.4ede19620.focal + PROTOCOL_21_CORE_DEBIAN_PKG_VERSION: 22.0.0-2088.rc1.2d8d764cd.focal + PROTOCOL_21_CORE_DOCKER_IMG: stellar/stellar-core:22.0.0-2088.rc1.2d8d764cd.focal + PROTOCOL_22_CORE_DEBIAN_PKG_VERSION: 22.0.0-2088.rc1.2d8d764cd.focal + PROTOCOL_22_CORE_DOCKER_IMG: stellar/stellar-core:22.0.0-2088.rc1.2d8d764cd.focal steps: - uses: actions/checkout@v4 From a4bb5166fb12f61261b9927c76176a169a39ce9a Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Wed, 2 Oct 2024 14:46:23 +0200 Subject: [PATCH 18/19] Fix dependency checking script --- scripts/check-dependencies.bash | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/check-dependencies.bash b/scripts/check-dependencies.bash index aa6a9b3a..651e9278 100755 --- a/scripts/check-dependencies.bash +++ b/scripts/check-dependencies.bash @@ -114,7 +114,9 @@ for P in $PROTOCOL_VERSIONS; do # We obtain it from src/rust/src/host-dep-tree-curr.txt but Alternatively/in addition we could: # * Check the rs-stellar-xdr revision of host-dep-tree-prev.txt # * Check the stellar-xdr revision - CORE_HOST_DEP_TREE_CURR=$($CURL https://raw.githubusercontent.com/stellar/stellar-core/${CORE_CONTAINER_REVISION}/src/rust/src/host-dep-tree-curr.txt) + + # FIXME: we shouldn't hardcode the protocol number in the file being checked + CORE_HOST_DEP_TREE_CURR=$($CURL https://raw.githubusercontent.com/stellar/stellar-core/${CORE_CONTAINER_REVISION}/src/rust/src/dep-trees/p22-expect.txt) RS_STELLAR_XDR_REVISION_FROM_CORE=$(echo "$CORE_HOST_DEP_TREE_CURR" | stellar_xdr_version_from_rust_dep_tree) From b6fd2ba885b16f473ebbbb8e69cb8e2e5ea8e654 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Wed, 2 Oct 2024 15:16:21 +0200 Subject: [PATCH 19/19] Bump integration tests Max Supported protocol version --- cmd/soroban-rpc/internal/integrationtest/infrastructure/test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/soroban-rpc/internal/integrationtest/infrastructure/test.go b/cmd/soroban-rpc/internal/integrationtest/infrastructure/test.go index 0a7b91ee..a800bd0e 100644 --- a/cmd/soroban-rpc/internal/integrationtest/infrastructure/test.go +++ b/cmd/soroban-rpc/internal/integrationtest/infrastructure/test.go @@ -35,7 +35,7 @@ import ( const ( StandaloneNetworkPassphrase = "Standalone Network ; February 2017" - MaxSupportedProtocolVersion = 21 + MaxSupportedProtocolVersion = 22 FriendbotURL = "http://localhost:8000/friendbot" // Needed when Core is run with ARTIFICIALLY_ACCELERATE_TIME_FOR_TESTING=true checkpointFrequency = 8