Skip to content

Commit

Permalink
Merge branch 'develop' into stateful-upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinssgh authored Sep 28, 2023
2 parents f5216fe + 007ff12 commit 3411ef4
Show file tree
Hide file tree
Showing 44 changed files with 343 additions and 210 deletions.
6 changes: 3 additions & 3 deletions .github/actions/upgrade-testing/scripts/raise_gov_proposal.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade",
"authority": os.environ["GOV_ADDRESS"],
"plan": {
"name": os.environ['VERSION'],
"name": os.environ['UPGRADE_NAME'],
"time": "0001-01-01T00:00:00Z",
"height": str(UPGRADE_HEIGHT).split('.')[0],
"info": os.environ["UPGRADE_INFO"],
Expand Down Expand Up @@ -44,13 +44,13 @@
# -y
# """

GOV_PROPOSAL = f"""zetacored tx gov submit-legacy-proposal software-upgrade "{os.environ['VERSION']}" \
GOV_PROPOSAL = f"""zetacored tx gov submit-legacy-proposal software-upgrade "{os.environ['UPGRADE_NAME']}" \
--from "{os.environ['MONIKER']}" \
--deposit {os.environ["DEPOSIT"]} \
--upgrade-height "{str(UPGRADE_HEIGHT).split('.')[0]}" \
--upgrade-info '{os.environ["UPGRADE_INFO"]}' \
--title "{os.environ['VERSION']}" \
--description "Zeta Release {os.environ['VERSION']}" \
--description "Zeta Release {os.environ['UPGRADE_NAME']}" \
--chain-id "{os.environ['CHAINID']}" \
--node "{os.environ['NODE']}" \
--keyring-backend test \
Expand Down
34 changes: 26 additions & 8 deletions .github/workflows/upgrade_path_testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ on:
workflow_dispatch:
inputs:
version:
description: 'The new version to upgrade to from latest state.'
description: 'The new version of tag you are going to download the binary from..'
required: true
default: 'v9.0.6'


default: 'v10.0.0-rc2'
upgrade_name:
description: 'The version that is set in setup_handlers.go'
required: true
default: 'v10.0.0'

jobs:
upgrade_path_test_state_export:
Expand All @@ -26,9 +28,10 @@ jobs:
LOG_LEVEL: "INFO"
CHAINID: "localnet_101-1"
DAEMON_HOME: "/home/runner/.zetacored"
UPGRADE_NAME: "${{ github.event.inputs.upgrade_name }}"
DAEMON_NAME: "zetacored"
DENOM: "azeta"
DAEMON_ALLOW_DOWNLOAD_BINARIES: "false"
DAEMON_ALLOW_DOWNLOAD_BINARIES: "true"
DAEMON_RESTART_AFTER_UPGRADE: "true"
MONIKER: "zeta"
BLOCK_TIME_SECONDS: "6"
Expand Down Expand Up @@ -91,6 +94,7 @@ jobs:
mkdir -p /home/runner/.zetacored/zetavisor
mkdir -p /home/runner/.zetacored/zetavisor/genesis/bin
mkdir -p /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin
mkdir -p /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.upgrade_name }}/bin
- name: "DOWNLOAD_STATE_EXPORT_AND_BINARIES"
run: |
Expand All @@ -100,12 +104,26 @@ jobs:
echo "*********DOWNLOAD UPGRADE BINARY AND PUT IN ZETAVISOR UPGRADES FOLDER*********"
wget -q ${github_binary_version_link} -O /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored
ZETACORED_CHECKSUM=$(shasum -b -a 256 /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored | cut -d ' ' -f 1)
sudo chmod a+x /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored
echo "UPGRADE_INFO=${UPGRADE_INFO}" >> ${GITHUB_ENV}
ls -lah /home/runner/.zetacored/zetavisor/upgrades/
ls -lah /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored
wget -q ${github_binary_version_link} -O /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.upgrade_name }}/bin/zetacored
ZETACORED_CHECKSUM=$(shasum -b -a 256 /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.upgrade_name }}/bin/zetacored | cut -d ' ' -f 1)
sudo chmod a+x /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.upgrade_name }}/bin/zetacored
echo "UPGRADE_INFO=${UPGRADE_INFO}" >> ${GITHUB_ENV}
ls -lah /home/runner/.zetacored/zetavisor/upgrades/
ls -lah /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.upgrade_name }}/bin/zetacored
echo "ZETACORED_CHECKSUM=${ZETACORED_CHECKSUM}" >> ${GITHUB_ENV}
UPGRADE_INFO='{"binaries": {"zetacored-linux/amd64": "https://github.com/zeta-chain/node/releases/download/${{ github.event.inputs.version }}/zetacored-ubuntu-22-amd64?checksum=sha256:'${ZETACORED_CHECKSUM}'"}}'
echo ${UPGRADE_INFO}
echo "UPGRADE_INFO=${UPGRADE_INFO}" >> ${GITHUB_ENV}
sudo chmod a+x /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored
echo "*********DOWNLOAD CURRENT BINARY AND PUT IN ZETAVISOR GENESIS & CURRENT FOLDER*********"
current_version=$(curl https://rpc-archive.athens.zetachain.com:26657/abci_info -s | jq .result.response.version -r | tr -d '\n')
echo "STARTING_VERSION=${current_version}" >> ${GITHUB_ENV}
Expand Down
5 changes: 3 additions & 2 deletions contrib/localnet/scripts/genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ then
cat $HOME/.zetacored/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="500000000"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json
cat $HOME/.zetacored/config/genesis.json | jq '.app_state["gov"]["voting_params"]["voting_period"]="100s"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json

# set fungible admin account as admin for fungible token
# set admin account
zetacored add-genesis-account zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk 100000000000000000000000000azeta
cat $HOME/.zetacored/config/genesis.json | jq '.app_state["observer"]["params"]["admin_policy"][2]["address"]="zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json
cat $HOME/.zetacored/config/genesis.json | jq '.app_state["observer"]["params"]["admin_policy"][0]["address"]="zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json
cat $HOME/.zetacored/config/genesis.json | jq '.app_state["observer"]["params"]["admin_policy"][1]["address"]="zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json

# 3. Copy the genesis.json to all the nodes .And use it to create a gentx for every node
zetacored gentx operator 1000000000000000000000azeta --chain-id=$CHAINID --keyring-backend=$KEYRING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -637,10 +637,11 @@
],
"admin_policy": [
{
"address": "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73"
"policy_type": "group1",
"address": "zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"
},
{
"policy_type": 1,
"policy_type": "group2",
"address": "zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -637,10 +637,11 @@
],
"admin_policy": [
{
"address": "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73"
"policy_type": "group1",
"address": "zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"
},
{
"policy_type": 1,
"policy_type": "group2",
"address": "zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"
}
]
Expand Down
11 changes: 3 additions & 8 deletions docs/openapi/openapi.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51057,14 +51057,9 @@ definitions:
observerPolicy_Type:
type: string
enum:
- stop_inbound_cctx
- deploy_fungible_coin
- update_client_params
- update_keygen_block
- out_tx_tracker
- add_observer
default: stop_inbound_cctx
title: '- stop_inbound_cctx: some observer sees inbound tx'
- group1
- group2
default: group1
observerQueryAllBlameRecordsResponse:
type: object
properties:
Expand Down
2 changes: 1 addition & 1 deletion docs/spec/crosschain/messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ message MsgRemoveFromOutTxTracker {

## MsgCreateTSSVoter

Vote on creating a TSS key and recording the information about it (public
CreateTSSVoter votes on creating a TSS key and recording the information about it (public
key, participant and operator addresses, finalized and keygen heights).

If the vote passes, the information about the TSS key is recorded on chain
Expand Down
5 changes: 2 additions & 3 deletions docs/spec/observer/messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ message MsgAddObserver {

## MsgUpdateCoreParams

Updates core parameters for a specific chain. Core parameters include
UpdateCoreParams updates core parameters for a specific chain. Core parameters include
confirmation count, outbound transaction schedule interval, ZETA token,
connector and ERC20 custody contract addresses, etc.

Expand Down Expand Up @@ -57,8 +57,7 @@ message MsgUpdateCrosschainFlags {

## MsgUpdateKeygen

Updates the block height of the keygen and sets the status to "pending
keygen".
UpdateKeygen updates the block height of the keygen and sets the status to "pending keygen".

Only the admin policy account is authorized to broadcast this message.

Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ require (
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.114.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.30.0 // indirect
google.golang.org/protobuf v1.30.0
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand All @@ -317,7 +317,6 @@ replace (
github.com/btcsuite/btcd => github.com/btcsuite/btcd v0.22.3
github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0

github.com/cosmos/cosmos-sdk => github.com/brewmaster012/cosmos-sdk v0.46.14-0.20230818184835-7b40e2ee9f2f
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
// replace broken goleveldb
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -725,8 +725,6 @@ github.com/bombsimon/wsl/v3 v3.3.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
github.com/breml/bidichk v0.2.3/go.mod h1:8u2C6DnAy0g2cEq+k/A2+tr9O1s+vHGxWn0LTc70T2A=
github.com/breml/errchkjson v0.3.0/go.mod h1:9Cogkyv9gcT8HREpzi3TiqBxCqDzo8awa92zSDFcofU=
github.com/brewmaster012/cosmos-sdk v0.46.14-0.20230818184835-7b40e2ee9f2f h1:iFcUpBqZvMf/7VMi1yOsFV1UdAn8aOhLZvLkfRlJWQk=
github.com/brewmaster012/cosmos-sdk v0.46.14-0.20230818184835-7b40e2ee9f2f/go.mod h1:EfY521ATNEla8eJ6oJuZBdgP5+p360s7InnRqX+TWdM=
github.com/brewmaster012/go-tss v0.0.0-20230724230849-ce080275bbad h1:/Jqi03d/vQ9SXDjubEKYGpv2usH5Ejjrmrdv405UFNo=
github.com/brewmaster012/go-tss v0.0.0-20230724230849-ce080275bbad/go.mod h1:RYOe4ihG8KkoQQhW6ljiyxyW6F3CoZA3ozyyEb5HVmI=
github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk=
Expand Down Expand Up @@ -1018,6 +1016,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk=
github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis=
github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o=
github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I=
github.com/cosmos/cosmos-sdk v0.46.13 h1:LhL6WDBadczqBuCW0t5BHUzGQR3vbujdOYOfU0ORt+o=
github.com/cosmos/cosmos-sdk v0.46.13/go.mod h1:EfY521ATNEla8eJ6oJuZBdgP5+p360s7InnRqX+TWdM=
github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 h1:iKclrn3YEOwk4jQHT2ulgzuXyxmzmPczUalMwW4XH9k=
github.com/cosmos/cosmos-sdk/ics23/go v0.8.0/go.mod h1:2a4dBq88TUoqoWAU5eu0lGvpFP3wWDPgdHPargtyw30=
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
Expand Down
8 changes: 2 additions & 6 deletions proto/observer/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,8 @@ message ObserverParams {

enum Policy_Type {
option (gogoproto.goproto_enum_stringer) = true;
stop_inbound_cctx = 0; // some observer sees inbound tx
deploy_fungible_coin = 1;
update_client_params = 2;
update_keygen_block = 3;
out_tx_tracker = 4;
add_observer = 5;
group1 = 0;
group2 = 1;
}

message Admin_Policy {
Expand Down
8 changes: 4 additions & 4 deletions x/crosschain/client/integrationtests/cli_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func BuildSignedTssVote(t testing.TB, val *network.Validator, denom string, acco
return WriteToNewTempFile(t, res.String())
}

func BuildSignedOutboundVote(t testing.TB, val *network.Validator, denom string, account authtypes.AccountI,
func BuildSignedOutboundVote(t testing.TB, val *network.Validator, denom string, account authtypes.AccountI, nonce uint64,
cctxIndex, outTxHash, valueReceived, status string) *os.File {
cmd := cli.CmdCCTXOutboundVoter()
outboundVoterArgs := []string{
Expand All @@ -135,7 +135,7 @@ func BuildSignedOutboundVote(t testing.TB, val *network.Validator, denom string,
valueReceived,
status,
strconv.FormatInt(common.GoerliChain().ChainId, 10),
"1",
strconv.FormatUint(nonce, 10),
"Zeta",
}
txArgs := []string{
Expand Down Expand Up @@ -205,7 +205,7 @@ func GetBallotIdentifier(message string) string {
return msg.Digest()
}

func GetBallotIdentifierOutBound(cctxindex, outtxHash, valueReceived string) string {
func GetBallotIdentifierOutBound(nonce uint64, cctxindex, outtxHash, valueReceived string) string {
msg := types.NewMsgVoteOnObservedOutboundTx(
"",
cctxindex,
Expand All @@ -217,7 +217,7 @@ func GetBallotIdentifierOutBound(cctxindex, outtxHash, valueReceived string) str
math.NewUintFromString(valueReceived),
0,
common.GoerliChain().ChainId,
1,
nonce,
common.CoinType_Zeta,
)
return msg.Digest()
Expand Down
10 changes: 5 additions & 5 deletions x/crosschain/client/integrationtests/outbound_voter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() {
cctx := crosschaintypes.QueryGetCctxResponse{}
s.NoError(broadcaster.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &cctx))
s.Assert().Equal(crosschaintypes.CctxStatus_PendingOutbound, cctx.CrossChainTx.CctxStatus.Status)

nonce := cctx.CrossChainTx.GetCurrentOutTxParam().OutboundTxTssNonce
// Check the vote in the ballot and vote the outbound tx
fakeVotes := []string{}
for _, val := range s.network.Validators {
Expand Down Expand Up @@ -194,8 +194,8 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() {
}

// Vote the outbound tx
signedTx := BuildSignedOutboundVote(s.T(), val, s.cfg.BondDenom, account, cctxIdentifier, outTxhash, test.valueReceived, votestring)
out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetBroadcastCommand(), []string{signedTx.Name(), "--broadcast-mode", "sync"})
signedTx := BuildSignedOutboundVote(s.T(), val, s.cfg.BondDenom, account, nonce, cctxIdentifier, outTxhash, test.valueReceived, votestring)
out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetBroadcastCommand(), []string{signedTx.Name(), "--broadcast-mode", "sync", "--output", "json"})
s.Require().NoError(err)
}
s.Require().NoError(s.network.WaitForNBlocks(2))
Expand All @@ -206,7 +206,7 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() {
s.NoError(broadcaster.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &cctx))
s.Assert().Equal(test.cctxStatus, cctx.CrossChainTx.CctxStatus.Status)

outboundBallotIdentifier := GetBallotIdentifierOutBound(cctxIdentifier, test.name, test.valueReceived)
outboundBallotIdentifier := GetBallotIdentifierOutBound(nonce, cctxIdentifier, test.name, test.valueReceived)

out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, observerCli.CmdBallotByIdentifier(), []string{outboundBallotIdentifier, "--output", "json"})
s.Require().NoError(err)
Expand All @@ -228,7 +228,7 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() {
}
}
if len(fakeVotes) > 0 {
outboundFakeBallotIdentifier := GetBallotIdentifierOutBound(cctxIdentifier, test.name+"falseVote", test.valueReceived)
outboundFakeBallotIdentifier := GetBallotIdentifierOutBound(nonce, cctxIdentifier, test.name+"falseVote", test.valueReceived)
out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, observerCli.CmdBallotByIdentifier(), []string{outboundFakeBallotIdentifier, "--output", "json"})
s.Require().NoError(err)
fakeBallot := observerTypes.QueryBallotByIdentifierResponse{}
Expand Down
Loading

0 comments on commit 3411ef4

Please sign in to comment.