diff --git a/.github/workflows/soroban-rpc.yml b/.github/workflows/soroban-rpc.yml index 7950e2412..78d25ba91 100644 --- a/.github/workflows/soroban-rpc.yml +++ b/.github/workflows/soroban-rpc.yml @@ -126,9 +126,10 @@ jobs: - name: Build soroban contract fixtures run: | - rustup update - rustup target add wasm32-unknown-unknown - make build-test-wasms + rustup update + rustup target add wasm32-unknown-unknown + make build_rust + make build-test-wasms - name: Install Captive Core run: | diff --git a/cmd/soroban-rpc/internal/test/simulate_transaction_test.go b/cmd/soroban-rpc/internal/test/simulate_transaction_test.go index cc6d4ed77..25764f26f 100644 --- a/cmd/soroban-rpc/internal/test/simulate_transaction_test.go +++ b/cmd/soroban-rpc/internal/test/simulate_transaction_test.go @@ -5,6 +5,7 @@ import ( "crypto/sha256" "fmt" "os" + "os/exec" "path" "runtime" "testing" @@ -836,3 +837,37 @@ func TestSimulateTransactionBumpAndRestoreFootprint(t *testing.T) { assert.NoError(t, err) sendSuccessfulTransaction(t, client, sourceAccount, tx) } + +func TestInstallContractWithCLI(t *testing.T) { + test := NewTest(t) + ch := jhttp.NewChannel(test.sorobanRPCURL(), nil) + client := jrpc2.NewClient(ch, nil) + + sourceAccount := keypair.Root(StandaloneNetworkPassphrase) + + tx, err := txnbuild.NewTransaction(txnbuild.TransactionParams{ + SourceAccount: &txnbuild.SimpleAccount{ + AccountID: keypair.Root(StandaloneNetworkPassphrase).Address(), + Sequence: 1, + }, + IncrementSequenceNum: false, + Operations: []txnbuild.Operation{&txnbuild.CreateAccount{ + Destination: "GDIY6AQQ75WMD4W46EYB7O6UYMHOCGQHLAQGQTKHDX4J2DYQCHVCR4W4", + Amount: "100000", + }}, + BaseFee: txnbuild.MinBaseFee, + Memo: nil, + Preconditions: txnbuild.Preconditions{ + TimeBounds: txnbuild.NewInfiniteTimeout(), + }, + }) + require.NoError(t, err) + sendSuccessfulTransaction(t, client, sourceAccount, tx) + cmd := exec.Command("cargo", "run", "--", "--vv", "contract", "install", "--wasm", "../../../../target/wasm32-unknown-unknown/test-wasms/test_hello_world.wasm", "--rpc-url", "http://localhost:8000/", "--network-passphrase", "Standalone Network ; February 2017") + require.NoError(t, err) + res, err := cmd.Output() + require.NoError(t, err) + wasm := getHelloWorldContract(t) + contractHash := xdr.Hash(sha256.Sum256(wasm)) + require.Contains(t, string(res), contractHash.HexString()) +}