Skip to content

Commit

Permalink
Merge branch 'main' into fix/logs
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal authored Jul 23, 2024
2 parents 971aa25 + 31cdfdd commit 1240206
Show file tree
Hide file tree
Showing 15 changed files with 512 additions and 266 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 35 additions & 28 deletions FULL_HELP_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ Extend the time to live ledger of a contract-data ledger entry.

If no keys are specified the contract itself is extended.

**Usage:** `stellar contract extend [OPTIONS] --ledgers-to-extend <LEDGERS_TO_EXTEND> --durability <DURABILITY> --source-account <SOURCE_ACCOUNT>`
**Usage:** `stellar contract extend [OPTIONS] --ledgers-to-extend <LEDGERS_TO_EXTEND> --source-account <SOURCE_ACCOUNT>`

###### **Options:**

Expand Down Expand Up @@ -424,6 +424,7 @@ Initialize a Soroban project with an example contract
* `-f`, `--frontend-template <FRONTEND_TEMPLATE>` — An optional flag to pass in a url for a frontend template repository.

Default value: ``
* `-o`, `--overwrite` — Overwrite all existing files.



Expand Down Expand Up @@ -534,7 +535,7 @@ Optimize a WASM file

Print the current value of a contract-data ledger entry

**Usage:** `stellar contract read [OPTIONS] --durability <DURABILITY> --source-account <SOURCE_ACCOUNT>`
**Usage:** `stellar contract read [OPTIONS] --source-account <SOURCE_ACCOUNT>`

###### **Options:**

Expand Down Expand Up @@ -581,7 +582,7 @@ Restore an evicted value for a contract-data legder entry.

If no keys are specificed the contract itself is restored.

**Usage:** `stellar contract restore [OPTIONS] --durability <DURABILITY> --source-account <SOURCE_ACCOUNT>`
**Usage:** `stellar contract restore [OPTIONS] --source-account <SOURCE_ACCOUNT>`

###### **Options:**

Expand Down Expand Up @@ -1060,7 +1061,7 @@ Start a container running a Stellar node, RPC, API, and friendbot (faucet).

By default, when starting a testnet container, without any optional arguments, it will run the equivalent of the following docker command:

`docker run --rm -p 8000:8000 --name stellar stellar/quickstart:testing --testnet --enable-soroban-rpc`
`docker run --rm -p 8000:8000 --name stellar stellar/quickstart:testing --testnet --enable rpc,horizon`

**Usage:** `stellar network start [OPTIONS] <NETWORK>`

Expand All @@ -1074,6 +1075,7 @@ By default, when starting a testnet container, without any optional arguments, i
###### **Options:**

* `-d`, `--docker-host <DOCKER_HOST>` — Optional argument to override the default docker host. This is useful when you are using a non-standard docker host path for your Docker-compatible container runtime, e.g. Docker Desktop defaults to $HOME/.docker/run/docker.sock instead of /var/run/docker.sock
* `--name <NAME>` — Optional argument to specify the container name
* `-l`, `--limits <LIMITS>` — Optional argument to specify the limits for the local network only
* `-p`, `--ports-mapping <PORTS_MAPPING>` — Argument to specify the `HOST_PORT:CONTAINER_PORT` mapping

Expand All @@ -1089,14 +1091,11 @@ By default, when starting a testnet container, without any optional arguments, i

Stop a network started with `network start`. For example, if you ran `stellar network start local`, you can use `stellar network stop local` to stop it.

**Usage:** `stellar network stop [OPTIONS] <NETWORK>`
**Usage:** `stellar network stop [OPTIONS] <NAME>`

###### **Arguments:**

* `<NETWORK>` — Network to stop

Possible values: `local`, `testnet`, `futurenet`, `pubnet`

* `<NAME>` — Container to stop

###### **Options:**

Expand All @@ -1112,24 +1111,21 @@ Commands to start, stop and get logs for a quickstart container

###### **Subcommands:**

* `logs`Tail logs of a running network container
* `start` — Start network
* `stop` — Stop a network started with `network container start`. For example, if you ran `network container start local`, you can use `network container stop local` to stop it
* `logs`Get logs from a running network container
* `start` — Start a container running a Stellar node, RPC, API, and friendbot (faucet)
* `stop` — Stop a network container started with `network container start`



## `stellar network container logs`

Tail logs of a running network container
Get logs from a running network container

**Usage:** `stellar network container logs [OPTIONS] <NETWORK>`
**Usage:** `stellar network container logs [OPTIONS] <NAME>`

###### **Arguments:**

* `<NETWORK>` — Network to tail

Possible values: `local`, `testnet`, `futurenet`, `pubnet`

* `<NAME>` — Container to get logs from

###### **Options:**

Expand All @@ -1139,15 +1135,13 @@ Tail logs of a running network container

## `stellar network container start`

Start network

Start a container running a Stellar node, RPC, API, and friendbot (faucet).

`stellar network start NETWORK [OPTIONS]`
`stellar network container start NETWORK [OPTIONS]`

By default, when starting a testnet container, without any optional arguments, it will run the equivalent of the following docker command:

`docker run --rm -p 8000:8000 --name stellar stellar/quickstart:testing --testnet --enable-soroban-rpc`
`docker run --rm -p 8000:8000 --name stellar stellar/quickstart:testing --testnet --enable rpc,horizon`

**Usage:** `stellar network container start [OPTIONS] <NETWORK>`

Expand All @@ -1161,6 +1155,7 @@ By default, when starting a testnet container, without any optional arguments, i
###### **Options:**

* `-d`, `--docker-host <DOCKER_HOST>` — Optional argument to override the default docker host. This is useful when you are using a non-standard docker host path for your Docker-compatible container runtime, e.g. Docker Desktop defaults to $HOME/.docker/run/docker.sock instead of /var/run/docker.sock
* `--name <NAME>` — Optional argument to specify the container name
* `-l`, `--limits <LIMITS>` — Optional argument to specify the limits for the local network only
* `-p`, `--ports-mapping <PORTS_MAPPING>` — Argument to specify the `HOST_PORT:CONTAINER_PORT` mapping

Expand All @@ -1172,16 +1167,13 @@ By default, when starting a testnet container, without any optional arguments, i

## `stellar network container stop`

Stop a network started with `network container start`. For example, if you ran `network container start local`, you can use `network container stop local` to stop it
Stop a network container started with `network container start`

**Usage:** `stellar network container stop [OPTIONS] <NETWORK>`
**Usage:** `stellar network container stop [OPTIONS] <NAME>`

###### **Arguments:**

* `<NETWORK>` — Network to stop

Possible values: `local`, `testnet`, `futurenet`, `pubnet`

* `<NAME>` — Container to stop

###### **Options:**

Expand All @@ -1206,6 +1198,7 @@ Sign, Simulate, and Send transactions
###### **Subcommands:**

* `simulate` — Simulate a transaction envelope from stdin
* `hash` — Calculate the hash of a transaction envelope from stdin



Expand All @@ -1227,6 +1220,20 @@ Simulate a transaction envelope from stdin



## `stellar tx hash`

Calculate the hash of a transaction envelope from stdin

**Usage:** `stellar tx hash [OPTIONS]`

###### **Options:**

* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config



## `stellar cache`

Cache for transactions and contract specs
Expand Down
12 changes: 12 additions & 0 deletions cmd/crates/soroban-test/tests/it/integration/hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,18 @@ async fn contract_data_read() {
.assert()
.success()
.stdout(predicates::str::starts_with("COUNTER,2"));

// ensure default durability = persistent works
sandbox
.new_assert_cmd("contract")
.arg("read")
.arg("--id")
.arg(id)
.arg("--key")
.arg(KEY)
.assert()
.success()
.stdout(predicates::str::starts_with("COUNTER,2"));
}

#[tokio::test]
Expand Down
19 changes: 19 additions & 0 deletions cmd/crates/soroban-test/tests/it/integration/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,22 @@ async fn txn_simulate() {
assembled_str
);
}

#[tokio::test]
async fn txn_hash() {
let sandbox = &TestEnv::new();

let xdr_base64 = "AAAAAgAAAACVk/0xt9tV/cUbF53iwQ3tkKLlq9zG2wV5qd9lRjZjlQAHt/sAFsKTAAAABAAAAAEAAAAAAAAAAAAAAABmOg6nAAAAAAAAAAEAAAAAAAAAGAAAAAAAAAABfcHs35M1GZ/JkY2+DHMs4dEUaqjynMnDYK/Gp0eulN8AAAAIdHJhbnNmZXIAAAADAAAAEgAAAAEFO1FR2Wg49QFY5KPOFAQ0bV5fN+7LD2GSQvOaHSH44QAAABIAAAAAAAAAAJWT/TG321X9xRsXneLBDe2QouWr3MbbBXmp32VGNmOVAAAACgAAAAAAAAAAAAAAADuaygAAAAABAAAAAQAAAAEFO1FR2Wg49QFY5KPOFAQ0bV5fN+7LD2GSQvOaHSH44QAAAY9SyLSVABbC/QAAABEAAAABAAAAAwAAAA8AAAASYXV0aGVudGljYXRvcl9kYXRhAAAAAAANAAAAJUmWDeWIDoxodDQXD2R2YFuP5K65ooYyx5lc87qDHZdjHQAAAAAAAAAAAAAPAAAAEGNsaWVudF9kYXRhX2pzb24AAAANAAAAcnsidHlwZSI6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iGflFt3Lp4L";

let expected_hash = "bcc9fa60c8f6607c981d6e1c65d77ae07617720113f9080fe5883d8e4a331a68";

let hash = sandbox
.new_assert_cmd("tx")
.arg("hash")
.write_stdin(xdr_base64.as_bytes())
.assert()
.success()
.stdout_as_str();

assert_eq!(hash.trim(), expected_hash);
}
1 change: 1 addition & 0 deletions cmd/soroban-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,4 @@ ureq = { version = "2.9.1", features = ["json"] }
assert_cmd = "2.0.4"
assert_fs = "1.0.7"
predicates = "2.1.5"
walkdir = "2.5.0"
Loading

0 comments on commit 1240206

Please sign in to comment.