From 43fb97b33907cfc4cc81d1e781307c79c86b5c7f Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Tue, 13 Jun 2023 11:55:29 -0500 Subject: [PATCH] test: DeliverInbound from un-provisioned account is discarded --- .../agoric-upgrade-10/actions.sh | 3 +++ .../agoric-upgrade-10/env_setup.sh | 24 ++++++++++++++++++- .../agoric-upgrade-10/test.sh | 5 ++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-10/actions.sh b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-10/actions.sh index 75a27d1de9c..1654578be83 100644 --- a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-10/actions.sh +++ b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-10/actions.sh @@ -10,6 +10,9 @@ set -x # agoric wallet show --from $GOV1ADDR waitForBlock 20 +# user1 has no mailbox provisioned; later we test that this was discarded +submitDeliverInbound user1 + # provision a new user wallet agd keys add user2 --keyring-backend=test 2>&1 | tee "$HOME/.agoric/user2.out" diff --git a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-10/env_setup.sh b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-10/env_setup.sh index 28fd8a876e1..298875e91e6 100644 --- a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-10/env_setup.sh +++ b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-10/env_setup.sh @@ -83,4 +83,26 @@ pushPriceOnce () { else echo "ERROR: pushPrice failed (using $nextOracle)" fi -} \ No newline at end of file +} + +# submit a DeliverInbound transaction +# +# see {agoric.swingset.MsgDeliverInbound} in swingset/msgs.proto +# https://github.com/Agoric/agoric-sdk/blob/5cc5ec8836dcd0c6e11b10799966b6e74601295d/golang/cosmos/proto/agoric/swingset/msgs.proto#L23 +submitDeliverInbound() { + sender="${1:-user1}" + + # ag-solo is a client that sends DeliverInbound transactions using a golang client + # @see {connectToChain} in chain-cosmos-sdk.js + # runHelper + # https://github.com/Agoric/agoric-sdk/blob/5cc5ec8836dcd0c6e11b10799966b6e74601295d/packages/solo/src/chain-cosmos-sdk.js + + # The payload is JSON.stringify([messages, highestAck]) + # https://github.com/Agoric/agoric-sdk/blob/5cc5ec8836dcd0c6e11b10799966b6e74601295d/packages/solo/src/chain-cosmos-sdk.js#L625 + # for example, this json was captured from a running `agoric start local-solo` + json='[[[1,"1:0:deliver:ro+1:rp-44;#[\"getConfiguration\",[]]"]],0]' + + agd tx swingset deliver "${json}" \ + --chain-id="$CHAINID" -ojson --yes \ + --from="$sender" --keyring-backend=test -b block +} diff --git a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-10/test.sh b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-10/test.sh index 34b83c16ad5..3f756b3ee77 100644 --- a/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-10/test.sh +++ b/packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-10/test.sh @@ -2,6 +2,11 @@ . ./upgrade-test-scripts/env_setup.sh +# DeliverInbound from un-provisioned account is discarded +# Note: sending to a provisioned account resulted in an .outbox of +# [[1,"1:1:resolve:fulfill:rp+44:ro-20;#\"$0.Alleged: notifier\""]] +test_val $(agd query swingset mailbox $USER1ADDR -o json | jq '.value |fromjson |.outbox') '[]' "DeliverInbound (getConfiguration) is discarded" + # provision pool has right balance test_val $(agd query bank balances agoric1megzytg65cyrgzs6fvzxgrcqvwwl7ugpt62346 -o json | jq -r '.balances | first | .amount ') "18750000"