Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 39 additions & 12 deletions Cargo.lock

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

8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,11 @@ typescript-bindings-fixtures: build-test-wasms
--overwrite


use-signing-plugin:
cargo install --force --locked --path ./cmd/crates/stellar-multisig-plugin --debug

use-old-signing-plugin:
cargo install --force --locked --path ./cmd/crates/stellar-old-multisig-plugin --debug

# PHONY lists all the targets that aren't file names, so that make would skip the timestamp based check.
.PHONY: publish clean fmt watch check rpc-test test build-test-wasms install build build-snapshot typescript-bindings-fixtures
.PHONY: publish clean fmt watch check rpc-test test build-test-wasms install build build-snapshot typescript-bindings-fixtures use-signing-plugin use-old-signing-plugin
2 changes: 2 additions & 0 deletions cmd/crates/soroban-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ impl TestEnv {
hd_path: None,
sign_with_lab: false,
sign_with_ledger: false,
plugin_arg: vec![],
sign_with_plugin: vec![],
},
fee: None,
inclusion_fee: None,
Expand Down
3 changes: 1 addition & 2 deletions cmd/crates/soroban-test/tests/it/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ mod contract;
mod cookbook;
mod custom_types;
mod dotenv;
mod fee_args;
mod fee_stats;
mod fees;
mod hello_world;
mod init;
mod keys;
Expand Down
32 changes: 0 additions & 32 deletions cmd/crates/soroban-test/tests/it/integration/fee_stats.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use predicates::prelude::predicate;
use soroban_cli::xdr::{self, Limits, ReadXdr};
use soroban_rpc::GetFeeStatsResponse;
use soroban_test::{AssertExt, TestEnv};

use super::util::deploy_hello;
use super::util::{deploy_hello, HELLO_WORLD};

fn get_inclusion_fee_from_xdr(tx_xdr: &str) -> u32 {
let tx = xdr::TransactionEnvelope::from_xdr_base64(tx_xdr, Limits::none()).unwrap();
Expand All @@ -13,6 +14,36 @@ fn get_inclusion_fee_from_xdr(tx_xdr: &str) -> u32 {
}
}

#[tokio::test]
async fn fee_stats_text_output() {
let sandbox = &TestEnv::new();
sandbox
.new_assert_cmd("fees")
.arg("stats")
.arg("--output")
.arg("text")
.assert()
.success()
.stdout(predicates::str::contains("Max Soroban Inclusion Fee:"))
.stdout(predicates::str::contains("Max Inclusion Fee:"))
.stdout(predicates::str::contains("Latest Ledger:"));
}

#[tokio::test]
async fn fee_stats_json_output() {
let sandbox = &TestEnv::new();
let output = sandbox
.new_assert_cmd("fees")
.arg("stats")
.arg("--output")
.arg("json")
.assert()
.success()
.stdout_as_str();
let fee_stats_response: GetFeeStatsResponse = serde_json::from_str(&output).unwrap();
assert!(matches!(fee_stats_response, GetFeeStatsResponse { .. }))
}

#[tokio::test]
async fn inclusion_fee_arg() {
let sandbox = &TestEnv::new();
Expand Down Expand Up @@ -138,3 +169,45 @@ async fn inclusion_fee_arg() {
.stdout_as_str();
assert_eq!(get_inclusion_fee_from_xdr(&tx_xdr), 100u32);
}

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

// install HELLO_WORLD
// don't test fee bump here as other integration tests upload WASMs, so this
// might be a no-op
let wasm_hash = sandbox
.new_assert_cmd("contract")
.arg("upload")
.arg("--wasm")
.arg(HELLO_WORLD.path().to_string_lossy().to_string())
.assert()
.success()
.stdout_as_str();

// deploy HELLO_WORLD with a high inclusion fee to trigger fee-bump wrapping
let id = sandbox
.new_assert_cmd("contract")
.arg("deploy")
.args(["--wasm-hash", wasm_hash.trim()])
.args(["--inclusion-fee", &(u32::MAX - 50).to_string()])
.assert()
.success()
.stdout_as_str();

// invoke HELLO_WORLD with a high resource fee to trigger fee-bump wrapping
let std_err = sandbox
.new_assert_cmd("contract")
.arg("invoke")
.args(["--id", &id.to_string()])
.args(["--resource-fee", &(u64::from(u32::MAX) + 1).to_string()])
.arg("--")
.arg("inc")
.assert()
.success()
.stderr_as_str();

// validate log output indicates fee bump was used
assert!(std_err.contains("Signing fee bump transaction"));
}
16 changes: 16 additions & 0 deletions cmd/crates/stellar-multisig-plugin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "stellar-signer-multisig"
version.workspace = true
rust-version.workspace = true
edition = "2021"
publish = false

[dependencies]
stellar-xdr = { workspace = true, features = ["curr", "std", "serde", "base64"] }
stellar-strkey = { workspace = true }
ed25519-dalek = { workspace = true }
sha2 = { workspace = true }
hex = { workspace = true }
serde_json = { workspace = true }
serde = { workspace = true, features = ["derive"] }
thiserror = { workspace = true }
Loading