Skip to content

Commit

Permalink
Merge branch 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mhofman committed Aug 2, 2023
2 parents ff00d64 + f20cc05 commit a9a77e8
Show file tree
Hide file tree
Showing 38 changed files with 152 additions and 1,085 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/test-all-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ jobs:
- name: yarn test (same-structure)
if: (success() || failure())
run: cd packages/same-structure && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT
- name: yarn test (sharing-service)
if: (success() || failure())
run: cd packages/sharing-service && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT
- name: yarn test (sparse-ints)
if: (success() || failure())
run: cd packages/sparse-ints && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT
Expand Down Expand Up @@ -712,6 +709,17 @@ jobs:
matrix:
bootstrap-version: ['test', 'main']
steps:
- name: free up additional worker space
run: |
# Workaround to provide additional free space for testing.
# https://github.com/actions/virtual-environments/issues/2840
df -h
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- uses: actions/checkout@v3
- name: docker build (sdk)
run: cd packages/deployment && ./scripts/test-docker-build.sh | $TEST_COLLECT
Expand Down
4 changes: 2 additions & 2 deletions golang/cosmos/proto/agoric/vstorage/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ message QueryCapDataRequest {
];
// remotableValueFormat indicates how to transform references to opaque but
// distinguishable Remotables into readable embedded representations.
// * "object" represents each Remotable as an `{ id, allegedName }` object.
// * "string" represents each Remotable as a bracketed string such as `[Alleged: IST brand {}]`.
// * "object" represents each Remotable as an `{ id, allegedName }` object, e.g. `{ "id": "board007", "allegedName": "IST brand" }`.
// * "string" represents each Remotable as a string with bracket-wrapped contents including its alleged name and id, e.g. "[Alleged: IST brand <board007>]".
string remotable_value_format = 10 [
(gogoproto.jsontag) = "remotableValueFormat",
(gogoproto.moretags) = "yaml:\"remotableValueFormat\""
Expand Down
7 changes: 5 additions & 2 deletions golang/cosmos/x/vstorage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ This is used by the SwingSet "bridge".

## External protobuf interface

gRPC via [Querier](./keeper/keeper.go)
and CometBFT method "abci_query" with params `{ "path": "/agoric.vstorage.Query/...", "data": "<hexadecimal representation of serialized protobuf>" }` via the same
RPC via [Querier](./keeper/grpc_query.go),
and [CometBFT method "abci_query"](https://docs.cometbft.com/main/rpc/#/ABCI/abci_query)
with params `path` "/agoric.vstorage.Query/..."
and `data` \<serialized protobuf per [vstorage/query.proto](../../proto/agoric/vstorage/query.proto)>
(also via [Querier](./keeper/grpc_query.go))
* /agoric.vstorage.Query/CapData
* /agoric.vstorage.Query/Children
* /agoric.vstorage.Query/Data
Expand Down
4 changes: 2 additions & 2 deletions golang/cosmos/x/vstorage/types/query.pb.go

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

1 change: 0 additions & 1 deletion packages/agoric-cli/src/sdk-package-names.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export default [
"@agoric/notifier",
"@agoric/pegasus",
"@agoric/same-structure",
"@agoric/sharing-service",
"@agoric/smart-wallet",
"@agoric/solo",
"@agoric/sparse-ints",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,16 @@ OFFER=$(mktemp -t agops.XXX)
agops vaults close --vaultId vault2 --giveMinted 5.75 --from $USER2ADDR --keyring-backend="test" >|"$OFFER"
agops perf satisfaction --from "$USER2ADDR" --executeOffer "$OFFER" --keyring-backend=test

# # TODO test bidding
# # TODO liquidations
# # agops inter bid by-price --price 1 --give 1.0IST --from $GOV1ADDR --keyring-backend test
# replicate state-sync of node
# this will cause the swing-store to prune some data
killAgd
EXPORT_DIR=$(mktemp -t -d swing-store-export-upgrade-10-XXX)
make_swing_store_snapshot $EXPORT_DIR || fail "Couldn't make swing-store snapshot"
test_val "$(compare_swing_store_export_data $EXPORT_DIR)" "match" "swing-store export data"
restore_swing_store_snapshot $EXPORT_DIR || fail "Couldn't restore swing-store snapshot"
rm -rf $EXPORT_DIR
startAgd

# # TODO fully test bidding
# # TODO test liquidations
agops inter bid by-price --price 1 --give 1.0IST --from $GOV1ADDR --keyring-backend test
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,50 @@ submitDeliverInbound() {
--chain-id="$CHAINID" -ojson --yes \
--from="$sender" --keyring-backend=test -b block
}

make_swing_store_snapshot() {( set -euo pipefail
EXPORT_DIR="$1"
/usr/src/agoric-sdk/packages/cosmic-swingset/src/export-kernel-db.js --home "$HOME/.agoric" --export-dir "$EXPORT_DIR" --verbose --include-export-data

EXPORT_MANIFEST_FILE="$EXPORT_DIR/export-manifest.json"
EXPORT_DATA_FILE="$EXPORT_DIR/$(cat "$EXPORT_MANIFEST_FILE" | jq -r .data)"
EXPORT_DATA_UNTRUSTED_FILE="${EXPORT_DATA_FILE%.*}-untrusted.jsonl"
EXPORT_HEIGHT=$(cat "$EXPORT_MANIFEST_FILE" | jq -r .blockHeight)
EXPORT_MANIFEST="$(cat $EXPORT_MANIFEST_FILE)"

mv "$EXPORT_DATA_FILE" "$EXPORT_DATA_UNTRUSTED_FILE"
agd export --height $EXPORT_HEIGHT | jq -cr '.app_state.vstorage.data[] | if .path | startswith("swingStore.") then [.path[11:],.value] else empty end' > "$EXPORT_DATA_FILE"

jq -n "$EXPORT_MANIFEST | .untrustedData=\"$(basename -- "$EXPORT_DATA_UNTRUSTED_FILE")\"" > "$EXPORT_MANIFEST_FILE"

echo "Successful swing-store export for block $EXPORT_HEIGHT"
)}

restore_swing_store_snapshot() {( set -euo pipefail
rm -f $HOME/.agoric/data/agoric/swingstore.sqlite

/usr/src/agoric-sdk/packages/cosmic-swingset/src/import-kernel-db.js --home "$HOME/.agoric" --export-dir "$1" --verbose
)}

compare_swing_store_export_data() {
EXPORT_DIR="$1"
EXPORT_MANIFEST_FILE="$EXPORT_DIR/export-manifest.json"
EXPORT_DATA_FILE="$(cat "$EXPORT_MANIFEST_FILE" | jq -r .data)"
EXPORT_DATA_UNTRUSTED_FILE="$(cat "$EXPORT_MANIFEST_FILE" | jq -r .untrustedData)"

if [ -z "$EXPORT_DATA_FILE" ]; then
echo "missing-export-data"
return
fi

if [ -z "$EXPORT_DATA_UNTRUSTED_FILE" ]; then
echo "missing-untrusted-export-data"
return
fi

diff <(cat "$EXPORT_DIR/$EXPORT_DATA_FILE" | sort) <(cat "$EXPORT_DIR/$EXPORT_DATA_UNTRUSTED_FILE" | sort) >&2 && {
echo "match"
} || {
echo "mismatch"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@ test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.vaults.
test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.vaults.vault2 -o jsonlines | jq -r '.vaultState') "closed" "vault2 is closed"
test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.vaults.vault2 -o jsonlines | jq -r '.locked.value') "0" "vault2 contains no collateral"
test_val $(agoric follow -l -F :published.vaultFactory.managers.manager0.vaults.vault2 -o jsonlines | jq -r '.debtSnapshot.debt.value') "0" "vault2 has no debt"

# verify state-sync would be broken
killAgd
EXPORT_DIR=$(mktemp -t -d swing-store-export-upgrade-10-XXX)
make_swing_store_snapshot $EXPORT_DIR || fail "Couldn't make swing-store snapshot"
test_val "$(compare_swing_store_export_data $EXPORT_DIR)" "mismatch" "swing-store broken state-sync"
rm -rf $EXPORT_DIR
startAgd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
# CWD is agoric-sdk
upgrade11=./upgrade-test-scripts/agoric-upgrade-11

######################################################################
# FIXME: remove this line when these tests don't hardcode bundle hashes.
echo 1>&2 "FIXME: skipping zoe-full-upgrade tests"; return 0

# Pre-steps:
# * fill Wallets
# * build and install bundles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ waitForBlock 2
upgrade11=./upgrade-test-scripts/agoric-upgrade-11

# zoe vat is at incarnation 1
echo "FIXME: bypassed zoe-full-upgrade validation"; return 0
test_val "$(yarn --silent node $upgrade11/vat-status.mjs zoe)" "1" "zoe vat incarnation"
20 changes: 20 additions & 0 deletions packages/deployment/upgrade-test/upgrade-test-scripts/env_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,26 @@ if [[ "$binary" == "agd" ]]; then
sed -i 's/minSubmissionCount": 3/minSubmissionCount": 1/g' /usr/src/agoric-sdk/packages/vats/*.json
fi

startAgd() {
agd start --log_level warn "$@" &
AGD_PID=$!
echo $AGD_PID > $HOME/.agoric/agd.pid
wait_for_bootstrap
waitForBlock 2
}

killAgd() {
AGD_PID=$(cat $HOME/.agoric/agd.pid)
kill $AGD_PID
rm $HOME/.agoric/agd.pid
wait $AGD_PID || true
}

waitAgd() {
wait $(cat $HOME/.agoric/agd.pid)
rm $HOME/.agoric/agd.pid
}

provisionSmartWallet() {
i="$1"
amount="$2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
grep -qF 'env_setup.sh' /root/.bashrc || echo ". ./upgrade-test-scripts/env_setup.sh" >> /root/.bashrc
grep -qF 'printKeys' /root/.bashrc || echo "printKeys" >> /root/.bashrc

tmux -V || apt install -y tmux
tmux -V 2>/dev/null || apt-get install -y tmux

if [[ "$DEST" == "1" ]] && [[ "$TMUX" == "" ]]; then
echo "launching entrypoint"
Expand All @@ -14,10 +14,7 @@ fi

. ./upgrade-test-scripts/env_setup.sh

agd start --log_level warn &
AGD_PID=$!
wait_for_bootstrap
waitForBlock 2
startAgd

if ! test -f "$HOME/.agoric/runActions-${THIS_NAME}"; then
runActions "pre_test"
Expand Down Expand Up @@ -61,9 +58,9 @@ if [[ "$DEST" != "1" ]]; then
done

sleep 2
kill $AGD_PID
killAgd
echo "ready for upgrade to $UPGRADE_TO"
else

wait $AGD_PID
waitAgd
fi
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,9 @@ test('agoricName invitation source errors', async t => {
}),
{
message:
'{"source":"agoricContract","instancePath":["psm-IST-AUSD"]} - Must have missing properties ["callPipe"]',
// TODO The pattern is here only as a temporary measure to tolerate
// the property order being sorted and not.
/\{("instancePath":\["psm-IST-AUSD"\]|,|"source":"agoricContract"){3}\} - Must have missing properties \["callPipe"\]/,
},
);
t.is(await E.get(getBalanceFor(anchor.brand)).value, 0n);
Expand Down
Loading

0 comments on commit a9a77e8

Please sign in to comment.