Skip to content

Commit 4c0c913

Browse files
authored
Merge pull request #4235 from sisuresh/settings
Soroban Settings Docs Reviewed-by: dmkozh
2 parents 3bc7e76 + e1a86bf commit 4c0c913

File tree

4 files changed

+77
-2
lines changed

4 files changed

+77
-2
lines changed

docs/software/soroban-settings.md

+15
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,22 @@ proposed upgrade.**
4646
1. `curl -G 'http://localhost:11626/dumpproposedsettings' --data-urlencode 'blob=<LINE_7_OUTPUT>'`
4747
5. Now schedule the upgrade on all the required validators using the output from line 7 (the `ConfigUpgradeSetKey`) and an agreed upon time in the future
4848
1. `curl -G 'http://localhost:11626/upgrades?mode=set&upgradetime=YYYY-MM-DDTHH:MM:SSZ' --data-urlencode 'configupgradesetkey=<LINE_7_OUTPUT>'`
49+
6. Update https://github.com/stellar-expert/staged-soroban-upgrades so https://stellar.expert/explorer/pubnet/protocol-history will show the proposed upgrade.
4950

51+
### Helper script
52+
A script to help with crafting the transactions above is available [here](../../scripts/settings-helper.sh) with usage details in [README.md](../../scripts/README.md), but it's important to be aware of how the underlying process works in case the script has some issues.
53+
54+
### Debugging
55+
If any of the transactions above fail during transaction submission, you should get a `TransactionResult` as a response with the reason.
56+
57+
Once the three transactions are run, you should see the proposed upgrade when running the `dumpproposedsettings` command [(step 4)](#propose-a-settings-upgrade). If you don't, then either one or more of the transactions above failed during application, or the upgrade is invalid.
58+
59+
If any of the transactions above fail during transaction application, the failure will most likely be due to one of the following, and you should confirm this by looking at the `TransactionResult` of the failed transaction using the Stellar Laboratory or an explorer -
60+
1. Resources are too low. You'll need to increase the hardcoded resources in [SettingsUpgradeUtils.cpp](../../src/main/SettingsUpgradeUtils.cpp).
61+
2. Fee or refundable fee is too low. You'll need to increase them in [SettingsUpgradeUtils.cpp](../../src/main/SettingsUpgradeUtils.cpp).
62+
3. Wasm has expired. You'll need to restore the Wasm.
63+
64+
If the transactions succeeded but the `dumpproposedsettings` command still returns an error, then the upgrade is invalid. The error reporting here needs to be improved, but the validity checks happen [here](../../src/herder/Upgrades.cpp).
5065

5166
## Examine a proposed upgrade
5267

scripts/README.md

+10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ This folder is for storing any scripts that may be helpful for using stellar-cor
44
## List of scripts
55
- [Overlay survey](#overlay-survey)
66
- [Diff Tracy CSV](#diff-tracy-csv)
7+
- [Parse Backtrace Dump](#parse-backtrace-dump)
78

89
### Overlay survey
910
- Name - `OverlaySurvey.py`
@@ -54,5 +55,14 @@ This folder is for storing any scripts that may be helpful for using stellar-cor
5455
./src/stellar-core(+0x34f0c1) [0x55c7cd1000c1]"
5556
```
5657

58+
### Soroban Settings Helper
59+
- Name - `settings-helper.sh`
60+
- Prequisites - `stellar-xdr` and `stellar-core`
61+
- Description - This is a script to help with the [Soroban Settings Upgrade](../docs/software/soroban-settings.md). It's important to be aware of how the underlying process works
62+
in case the script has some issues, so please read through that doc before attempting to use this script. This script should be run from the directory that contains your stellar-core binary. This script also queries the SDF Horizon for the sequence number of the account, so if the SDF Horizon instance is unavailable, then you'll need to provide the account's sequence number manually.
63+
- Usage - Ex. `sh ../scripts/settings-helper.sh SCSQHJIUGUGTH2P4K6AOFTEW4HUMI2BRTUBBDDXMQ4FLHXCX25W3PGBJ 'Test SDF Network ; September 2015' ../soroban-settings/testnet_settings_phase2.json`. The first argument is the secret key of the source account that will be used for the transactions to set up the upgrade, the second argument is the the network passphrase, and the third is
64+
the path to the JSON file with the proposed settings.
65+
66+
5767
## Style guide
5868
We follow [PEP-0008](https://www.python.org/dev/peps/pep-0008/).

scripts/settings-helper.sh

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/sh
2+
set -e
3+
4+
SECRET_KEY="$1"
5+
PUBLIC_KEY=$(./stellar-core convert-id "$SECRET_KEY" | sed -n '4p' | awk '{print $NF}')
6+
echo "PUBLIC_KEY is $PUBLIC_KEY"
7+
8+
PUBNET_HORIZON="https://horizon.stellar.org/accounts"
9+
PUBNET_PASSPHRASE="Public Global Stellar Network ; September 2015"
10+
11+
TESTNET_HORIZON="https://horizon-testnet.stellar.org/accounts"
12+
TESTNET_PASSPHRASE="Test SDF Network ; September 2015"
13+
14+
HORIZON=""
15+
16+
#choose which horizon to hit for the SEQ_NUM. If Horizon is down, remove this code and manually set SEQ_NUM below
17+
if [ "$2" == "$PUBNET_PASSPHRASE" ]
18+
then
19+
HORIZON=$PUBNET_HORIZON
20+
elif [ "$2" == "$TESTNET_PASSPHRASE" ]
21+
then
22+
HORIZON=$TESTNET_HORIZON
23+
else
24+
echo "invalid passphrase"
25+
fi
26+
27+
# get seq num
28+
SEQ_NUM="$(curl -s "$HORIZON/$PUBLIC_KEY" | grep "\"sequence\":" | sed 's/[^0-9]//g')"
29+
re='^[0-9]+$'
30+
if ! [[ $SEQ_NUM =~ $re ]] ; then
31+
echo "Error: SEQ_NUM not retrieved. Your account might not be funded, or Horizon might be down. Hardcode the SEQ_NUM below and remove the horizon code." >&2; exit 1
32+
fi
33+
34+
OUTPUT="$(echo $SECRET_KEY | ./stellar-core get-settings-upgrade-txs "$PUBLIC_KEY" "$SEQ_NUM" "$2" --xdr $(stellar-xdr encode --type ConfigUpgradeSet $3) --signtxs)"
35+
36+
echo "----- TX #1 -----"
37+
echo "curl -G 'http://localhost:11626/tx' --data-urlencode 'blob=$(echo "$OUTPUT" | sed -n '1p')'"
38+
39+
echo "----- TX #2 -----"
40+
echo "curl -G 'http://localhost:11626/tx' --data-urlencode 'blob=$(echo "$OUTPUT" | sed -n '3p')'"
41+
42+
echo "----- TX #3 -----"
43+
echo "curl -G 'http://localhost:11626/tx' --data-urlencode 'blob=$(echo "$OUTPUT" | sed -n '5p')'"
44+
echo "-----"
45+
46+
echo "curl -G 'http://localhost:11626/dumpproposedsettings' --data-urlencode 'blob=$(echo "$OUTPUT" | sed -n '7p')'"
47+
echo "-----"
48+
49+
echo "distribute the following command with the upgradetime set to an agreed upon point in the future"
50+
echo "curl -G 'http://localhost:11626/upgrades?mode=set&upgradetime=YYYY-MM-DDT01:25:00Z' --data-urlencode 'configupgradesetkey=$(echo "$OUTPUT" | sed -n '7p')'"

src/main/SettingsUpgradeUtils.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ getCreateTx(PublicKey const& publicKey, LedgerKey const& contractCodeLedgerKey,
6363

6464
auto& tx = txEnv.v1().tx;
6565
tx.sourceAccount = toMuxedAccount(publicKey);
66-
tx.fee = 15'000'000;
66+
tx.fee = 25'000'000;
6767
tx.seqNum = seqNum;
6868

6969
Preconditions cond;
@@ -133,7 +133,7 @@ getCreateTx(PublicKey const& publicKey, LedgerKey const& contractCodeLedgerKey,
133133

134134
tx.ext.v(1);
135135
tx.ext.sorobanData().resources = uploadResources;
136-
tx.ext.sorobanData().resourceFee = 7'000'000;
136+
tx.ext.sorobanData().resourceFee = 15'000'000;
137137

138138
return {txEnv, contractSourceRefLedgerKey, contractID};
139139
}

0 commit comments

Comments
 (0)