Skip to content
Merged
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
6 changes: 5 additions & 1 deletion cmd/goal/clerk.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,11 @@ var inspectCmd = &cobra.Command{
if err != nil {
reportErrorf(txDecodeError, txFilename, err)
}
fmt.Printf("%s[%d]\n%s\n\n", txFilename, count, string(protocol.EncodeJSON(txn)))
sti, err := inspectTxn(txn)
if err != nil {
reportErrorf(txDecodeError, txFilename, err)
}
fmt.Printf("%s[%d]\n%s\n\n", txFilename, count, string(protocol.EncodeJSON(sti)))
}
}
},
Expand Down
116 changes: 116 additions & 0 deletions cmd/goal/inspect.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// Copyright (C) 2019 Algorand, Inc.
// This file is part of go-algorand
//
// go-algorand is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// go-algorand is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with go-algorand. If not, see <https://www.gnu.org/licenses/>.

package main

import (
"fmt"
"reflect"

"github.com/algorand/go-algorand/crypto"
"github.com/algorand/go-algorand/data/basics"
"github.com/algorand/go-algorand/data/transactions"
"github.com/algorand/go-algorand/protocol"
)

// inspectSignedTxn is isomorphic to SignedTxn but uses different
// types to print public keys using algorand's address format
// (base32 + checksum) in JSON, instead of the default base64.
type inspectSignedTxn struct {
_struct struct{} `codec:",omitempty,omitemptyarray"`

Sig crypto.Signature `codec:"sig"`
Msig inspectMultisigSig `codec:"msig"`
Txn transactions.Transaction `codec:"txn"`
}

// inspectMultisigSig is isomorphic to MultisigSig but uses different
// types to print public keys using algorand's address format in JSON.
type inspectMultisigSig struct {
_struct struct{} `codec:",omitempty,omitemptyarray"`

Version uint8 `codec:"v"`
Threshold uint8 `codec:"thr"`
Subsigs []inspectMultisigSubsig `codec:"subsig"`
}

// inspectMultisigSig is isomorphic to MultisigSig but uses different
// types to print public keys using algorand's address format in JSON.
type inspectMultisigSubsig struct {
_struct struct{} `codec:",omitempty,omitemptyarray"`

Key basics.Address `codec:"pk"`
Sig crypto.Signature `codec:"s"`
}

func inspectTxn(stxn transactions.SignedTxn) (sti inspectSignedTxn, err error) {
sti = txnToInspect(stxn)
if !reflect.DeepEqual(stxn, txnFromInspect(sti)) {
err = fmt.Errorf("non-idempotent transformation to inspectSignedTxn (DeepEqual)")
}
if !reflect.DeepEqual(protocol.Encode(sti), protocol.Encode(stxn)) {
err = fmt.Errorf("non-idempotent transformation to inspectSignedTxn (protocol.Encode)")
}
return
}

func txnToInspect(stxn transactions.SignedTxn) inspectSignedTxn {
return inspectSignedTxn{
Txn: stxn.Txn,
Sig: stxn.Sig,
Msig: msigToInspect(stxn.Msig),
}
}

func txnFromInspect(sti inspectSignedTxn) transactions.SignedTxn {
return transactions.SignedTxn{
Txn: sti.Txn,
Sig: sti.Sig,
Msig: msigFromInspect(sti.Msig),
}
}

func msigToInspect(msig crypto.MultisigSig) inspectMultisigSig {
res := inspectMultisigSig{
Version: msig.Version,
Threshold: msig.Threshold,
}

for _, subsig := range msig.Subsigs {
res.Subsigs = append(res.Subsigs, inspectMultisigSubsig{
Sig: subsig.Sig,
Key: basics.Address(subsig.Key),
})
}

return res
}

func msigFromInspect(msi inspectMultisigSig) crypto.MultisigSig {
res := crypto.MultisigSig{
Version: msi.Version,
Threshold: msi.Threshold,
}

for _, subsig := range msi.Subsigs {
res.Subsigs = append(res.Subsigs, crypto.MultisigSubsig{
Sig: subsig.Sig,
Key: crypto.PublicKey(subsig.Key),
})
}

return res
}
6 changes: 3 additions & 3 deletions cmd/updater/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ while [ "$1" != "" ]; do
-g)
shift
GENESIS_NETWORK_DIR=$1
GENESIS_NETWORK_DIR_SPEC=-g $1
GENESIS_NETWORK_DIR_SPEC="-g $1"
;;
-b)
shift
Expand Down Expand Up @@ -330,7 +330,7 @@ function copy_genesis_files() {
function check_for_new_ledger() {
CURDATADIR=$1
echo "Checking for new ledger in ${CURDATADIR}"
EXISTING_VER="$(head -n 1 ${CURDATADIR}/wallet-genesis.id)"
EXISTING_VER=$(${UPDATESRCDIR}/bin/algod -d ${CURDATADIR} -g ${CURDATADIR}/genesis.json -G)

if [ -z $EXISTING_VER ]; then
if [ -z ${GENESIS_NETWORK_DIR} ]; then
Expand Down Expand Up @@ -359,10 +359,10 @@ function check_for_new_ledger() {
# changed the file itself in a compatible way.
cp ${UPDATESRCDIR}/genesis/${GENESIS_NETWORK_DIR}/genesis.json ${CURDATADIR}

echo ${NEW_VER} > ${CURDATADIR}/wallet-genesis.id
if [ "${NEW_VER}" != "${EXISTING_VER}" ]; then
echo "New genesis ID, resetting wallets"
NEW_LEDGER=1
echo ${NEW_VER} > ${CURDATADIR}/wallet-genesis.id
reset_wallets_for_new_ledger ${CURDATADIR}

import_rootkeys ${CURDATADIR}
Expand Down
2 changes: 2 additions & 0 deletions installer/debian/conffiles
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/etc/apt/apt.conf.d/50algorand-upgrades
/var/lib/algorand/genesis.json
30 changes: 30 additions & 0 deletions installer/rpm/RPM-GPG-KEY-Algorand
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----

mQENBF0BeeQBCADIUu66SGiqaFFcKY18unyFGvq2VU/uoHUiKbMsagvbHxggXeMk
x6t4E1XJ89wmoQJNuxVGGNSaCtdEh65+l5XRrzKJUDb/9CLuf2dvVLWq0sZAo48z
3KW8Si1yrh7rOiOmX46w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E3M2Tuz0Ei2j
09x1ABEBAAGJATwEGAEIACYWIQQTk8G1ae02MJH9u2YimZ7Zkai6QQUCXQF55AIb
DAUJA8JnAAAKCRAimZ7Zkai6QT6bCACdnrW9Sp2LyfHLKNb3j/WOWX15r8vCcjdG
Xn8bVkwB2KApsICSnW9xtQPBMfoQwlAFcJuaIFcEIl0TyWRamLdRFh+773IKoQgw
YZ0WDx6sNnUB/e9aCuio1kAxmfEXWvEWu7JLN4J5FFmgzJs2JYNSeBRm4kbPjwe/
zKdBBMK05ND348Jnduj1kZ6fwWKWIue3+nIVUCxyZao5dRp6zhEPtN5gDFpc18uT
kXNB/j0KjwzFUOB3u1ioOMxfbiga9B2fJZO/OSsm+3S4AGNCrn96hRCHnsgPehGT
AZEyE+M1SYulIyylMIcWwOVWUSKxmeSR20g1H83wWZqNpYmdgY24
=gLD6
-----END PGP PUBLIC KEY BLOCK-----
2 changes: 1 addition & 1 deletion installer/rpm/algorand.repo
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ name=Algorand
baseurl=http://algorand-releases.s3-website-us-east-1.amazonaws.com/rpm/stable/
enabled=1
gpgcheck=1
gpgkey=http://algorand-releases.s3-website-us-east-1.amazonaws.com/key.pub
gpgkey=https://releases.algorand.com/rpm/rpm_algorand.pub
6 changes: 3 additions & 3 deletions installer/rpm/algorand.spec
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ fi
/usr/bin/goal
/var/lib/algorand/config.json.example
/var/lib/algorand/system.json
/var/lib/algorand/genesis.json
%config(noreplace) /var/lib/algorand/genesis.json
%if %{RELEASE_GENESIS_PROCESS} != "x"
/var/lib/algorand/genesis/devnet/genesis.json
/var/lib/algorand/genesis/testnet/genesis.json
/var/lib/algorand/genesis/mainnet/genesis.json
%endif
/lib/systemd/system/algorand.service
/etc/cron.hourly/0yum-algorand-hourly.cron
/etc/yum/yum-cron-algorand.conf
%config(noreplace) /etc/cron.hourly/0yum-algorand-hourly.cron
%config(noreplace) /etc/yum/yum-cron-algorand.conf
/etc/pki/rpm-gpg/RPM-GPG-KEY-Algorand
/usr/lib/algorand/yum.repos.d/algorand.repo

Expand Down
2 changes: 1 addition & 1 deletion scripts/build_deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ for f in "${unattended_upgrades_files[@]}"; do
done

mkdir -p ${PKG_ROOT}/DEBIAN
debian_files=("control" "postinst" "prerm" "postrm")
debian_files=("control" "postinst" "prerm" "postrm" "conffiles")
for ctl in "${debian_files[@]}"; do
# Copy first, to preserve permissions, then overwrite to fill in template.
cp -a installer/debian/${ctl} ${PKG_ROOT}/DEBIAN/${ctl}
Expand Down