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
2 changes: 1 addition & 1 deletion agreement/proposalStore.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ func (store *proposalStore) lastRelevant(pv proposalValue) (p period, pinned boo
}

for per := range store.Relevant {
if per > p {
if per > p && store.Relevant[per] == pv {
p = per
}
}
Expand Down
2 changes: 1 addition & 1 deletion buildnumber.dat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2
3
4 changes: 4 additions & 0 deletions cmd/algod/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ func main() {
if err != nil {
fmt.Fprintln(os.Stdout, "error loading telemetry config", err)
}
if os.IsPermission(err) {
fmt.Fprintf(os.Stderr, "Permission error on accessing telemetry config: %v", err)
os.Exit(1)
}

// Apply telemetry override.
telemetryConfig.Enable = logging.TelemetryOverride(*telemetryOverride)
Expand Down
5 changes: 3 additions & 2 deletions cmd/goal/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,10 @@ var listCmd = &cobra.Command{
if err == nil {
params, ok := creatorInfo.AssetParams[aid]
if ok {
unitName = "units"
if params.UnitName != "" {
unitName = params.UnitName
}
unitName = "units"
if params.AssetName != "" {
assetName = fmt.Sprintf(", name %s", params.AssetName)
}
Expand Down Expand Up @@ -859,7 +859,8 @@ var listParticipationKeysCmd = &cobra.Command{
if err == nil {
votingBytes := parts[fn].Voting.OneTimeSignatureVerifier
vrfBytes := parts[fn].VRF.PK
if string(onlineAccountInfo.Participation.ParticipationPK) == string(votingBytes[:]) &&
if onlineAccountInfo.Participation != nil &&
(string(onlineAccountInfo.Participation.ParticipationPK) == string(votingBytes[:])) &&
(string(onlineAccountInfo.Participation.VRFPK) == string(vrfBytes[:])) &&
(onlineAccountInfo.Participation.VoteFirst == uint64(parts[fn].FirstValid)) &&
(onlineAccountInfo.Participation.VoteLast == uint64(parts[fn].LastValid)) &&
Expand Down
10 changes: 10 additions & 0 deletions cmd/goal/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func init() {
createAssetCmd.Flags().StringVarP(&txFilename, "out", "o", "", "Write transaction to this file")
createAssetCmd.Flags().BoolVarP(&sign, "sign", "s", false, "Use with -o to indicate that the dumped transaction should be signed")
createAssetCmd.Flags().StringVar(&noteBase64, "noteb64", "", "Note (URL-base64 encoded)")
createAssetCmd.Flags().StringVarP(&lease, "lease", "x", "", "Lease value (base64, optional): no transaction may also acquire this lease until lastvalid")
createAssetCmd.Flags().StringVarP(&noteText, "note", "n", "", "Note text (ignored if --noteb64 used also)")
createAssetCmd.Flags().BoolVarP(&noWaitAfterSend, "no-wait", "N", false, "Don't wait for transaction to commit")
createAssetCmd.MarkFlagRequired("total")
Expand All @@ -86,6 +87,7 @@ func init() {
destroyAssetCmd.Flags().StringVarP(&txFilename, "out", "o", "", "Write transaction to this file")
destroyAssetCmd.Flags().BoolVarP(&sign, "sign", "s", false, "Use with -o to indicate that the dumped transaction should be signed")
destroyAssetCmd.Flags().StringVar(&noteBase64, "noteb64", "", "Note (URL-base64 encoded)")
destroyAssetCmd.Flags().StringVarP(&lease, "lease", "x", "", "Lease value (base64, optional): no transaction may also acquire this lease until lastvalid")
destroyAssetCmd.Flags().StringVarP(&noteText, "note", "n", "", "Note text (ignored if --noteb64 used also)")
destroyAssetCmd.Flags().BoolVarP(&noWaitAfterSend, "no-wait", "N", false, "Don't wait for transaction to commit")

Expand All @@ -105,6 +107,7 @@ func init() {
configAssetCmd.Flags().BoolVarP(&sign, "sign", "s", false, "Use with -o to indicate that the dumped transaction should be signed")
configAssetCmd.Flags().StringVar(&noteBase64, "noteb64", "", "Note (URL-base64 encoded)")
configAssetCmd.Flags().StringVarP(&noteText, "note", "n", "", "Note text (ignored if --noteb64 used also)")
configAssetCmd.Flags().StringVarP(&lease, "lease", "x", "", "Lease value (base64, optional): no transaction may also acquire this lease until lastvalid")
configAssetCmd.Flags().BoolVarP(&noWaitAfterSend, "no-wait", "N", false, "Don't wait for transaction to commit")
configAssetCmd.MarkFlagRequired("manager")

Expand All @@ -123,6 +126,7 @@ func init() {
sendAssetCmd.Flags().StringVarP(&txFilename, "out", "o", "", "Write transaction to this file")
sendAssetCmd.Flags().BoolVarP(&sign, "sign", "s", false, "Use with -o to indicate that the dumped transaction should be signed")
sendAssetCmd.Flags().StringVar(&noteBase64, "noteb64", "", "Note (URL-base64 encoded)")
sendAssetCmd.Flags().StringVarP(&lease, "lease", "x", "", "Lease value (base64, optional): no transaction may also acquire this lease until lastvalid")
sendAssetCmd.Flags().StringVarP(&noteText, "note", "n", "", "Note text (ignored if --noteb64 used also)")
sendAssetCmd.Flags().BoolVarP(&noWaitAfterSend, "no-wait", "N", false, "Don't wait for transaction to commit")
sendAssetCmd.MarkFlagRequired("to")
Expand All @@ -142,6 +146,7 @@ func init() {
freezeAssetCmd.Flags().BoolVarP(&sign, "sign", "s", false, "Use with -o to indicate that the dumped transaction should be signed")
freezeAssetCmd.Flags().StringVar(&noteBase64, "noteb64", "", "Note (URL-base64 encoded)")
freezeAssetCmd.Flags().StringVarP(&noteText, "note", "n", "", "Note text (ignored if --noteb64 used also)")
freezeAssetCmd.Flags().StringVarP(&lease, "lease", "x", "", "Lease value (base64, optional): no transaction may also acquire this lease until lastvalid")
freezeAssetCmd.Flags().BoolVarP(&noWaitAfterSend, "no-wait", "N", false, "Don't wait for transaction to commit")
freezeAssetCmd.MarkFlagRequired("freezer")
freezeAssetCmd.MarkFlagRequired("account")
Expand Down Expand Up @@ -230,6 +235,7 @@ var createAssetCmd = &cobra.Command{
}

tx.Note = parseNoteField(cmd)
tx.Lease = parseLease(cmd)

fv, lv, err := client.ComputeValidityRounds(firstValid, lastValid, numValidRounds)
if err != nil {
Expand Down Expand Up @@ -304,6 +310,7 @@ var destroyAssetCmd = &cobra.Command{
}

tx.Note = parseNoteField(cmd)
tx.Lease = parseLease(cmd)

firstValid, lastValid, err = client.ComputeValidityRounds(firstValid, lastValid, numValidRounds)
if err != nil {
Expand Down Expand Up @@ -391,6 +398,7 @@ var configAssetCmd = &cobra.Command{
}

tx.Note = parseNoteField(cmd)
tx.Lease = parseLease(cmd)

firstValid, lastValid, err = client.ComputeValidityRounds(firstValid, lastValid, numValidRounds)
if err != nil {
Expand Down Expand Up @@ -471,6 +479,7 @@ var sendAssetCmd = &cobra.Command{
}

tx.Note = parseNoteField(cmd)
tx.Lease = parseLease(cmd)

firstValid, lastValid, err = client.ComputeValidityRounds(firstValid, lastValid, numValidRounds)
if err != nil {
Expand Down Expand Up @@ -534,6 +543,7 @@ var freezeAssetCmd = &cobra.Command{
}

tx.Note = parseNoteField(cmd)
tx.Lease = parseLease(cmd)

firstValid, lastValid, err = client.ComputeValidityRounds(firstValid, lastValid, numValidRounds)
if err != nil {
Expand Down
31 changes: 17 additions & 14 deletions cmd/goal/clerk.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,21 @@ func parseNoteField(cmd *cobra.Command) []byte {
return noteBytes
}

func parseLease(cmd *cobra.Command) (leaseBytes [32]byte) {
// Parse lease field
if cmd.Flags().Changed("lease") {
leaseBytesRaw, err := base64.StdEncoding.DecodeString(lease)
if err != nil {
reportErrorf(malformedLease, lease, err)
}
if len(leaseBytesRaw) != 32 {
reportErrorf(malformedLease, lease, fmt.Errorf("lease length %d != 32", len(leaseBytesRaw)))
}
copy(leaseBytes[:], leaseBytesRaw)
}
return
}

var sendCmd = &cobra.Command{
Use: "send",
Short: "Send money to an address",
Expand Down Expand Up @@ -301,21 +316,9 @@ var sendCmd = &cobra.Command{
}
toAddressResolved := accountList.getAddressByName(toAddress)

// Parse lease field
var leaseBytes [32]byte
if cmd.Flags().Changed("lease") {
leaseBytesRaw, err := base64.StdEncoding.DecodeString(lease)
if err != nil {
reportErrorf(malformedLease, lease, err)
}
if len(leaseBytesRaw) != 32 {
reportErrorf(malformedLease, lease, fmt.Errorf("lease length %d != 32", len(leaseBytesRaw)))
}
copy(leaseBytes[:], leaseBytesRaw)
}

// Parse notes field
// Parse notes and lease fields
noteBytes := parseNoteField(cmd)
leaseBytes := parseLease(cmd)

// If closing an account, resolve that address as well
var closeToAddressResolved string
Expand Down
3 changes: 3 additions & 0 deletions cmd/goal/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ const (
soFlagError = "-s is not meaningful without -o"
infoRawTxIssued = "Raw transaction ID %s issued"
txPoolError = "Transaction %s kicked out of local node pool: %s"
addrNoSigError = "Exactly one of --address or --no-sig is required"
msigLookupError = "Could not lookup multisig information: %s"
msigParseError = "Multisig information parsing error: %s"

infoAutoFeeSet = "Automatically set fee to %d MicroAlgos"

Expand Down
34 changes: 27 additions & 7 deletions cmd/goal/multisig.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
var (
addr string
msigAddr string
noSig bool
)

func init() {
Expand All @@ -44,8 +45,8 @@ func init() {

addSigCmd.Flags().StringVarP(&txFilename, "tx", "t", "", "Partially-signed transaction file to add signature to")
addSigCmd.Flags().StringVarP(&addr, "address", "a", "", "Address of the key to sign with")
addSigCmd.Flags().BoolVarP(&noSig, "no-sig", "n", false, "Fill in the transaction's multisig field with public keys and threshold information, but don't produce a signature")
addSigCmd.MarkFlagRequired("tx")
addSigCmd.MarkFlagRequired("address")

signProgramCmd.Flags().StringVarP(&programSource, "program", "p", "", "Program source to be compiled and signed")
signProgramCmd.Flags().StringVarP(&progByteFile, "program-bytes", "P", "", "Program binary to be signed")
Expand Down Expand Up @@ -76,12 +77,19 @@ var addSigCmd = &cobra.Command{
Long: `Start a multisig, or add a signature to an existing multisig, for a given transaction`,
Args: validateNoPosArgsFn,
Run: func(cmd *cobra.Command, _ []string) {

data, err := readFile(txFilename)
if err != nil {
reportErrorf(fileReadError, txFilename, err)
}

// --address and --no-sig are mutually exclusive, since if
// we're not signing we don't need an address
if addr == "" && !noSig {
reportErrorf(addrNoSigError)
} else if addr != "" && noSig {
reportErrorf(addrNoSigError)
}

dataDir := ensureSingleDataDir()
client := ensureKmdClient(dataDir)
wh, pw := ensureWalletHandleMaybePassword(dataDir, walletName, true)
Expand All @@ -98,9 +106,21 @@ var addSigCmd = &cobra.Command{
reportErrorf(txDecodeError, txFilename, err)
}

msig, err := client.MultisigSignTransactionWithWallet(wh, pw, stxn.Txn, addr, stxn.Msig)
if err != nil {
reportErrorf(errorSigningTX, err)
var msig crypto.MultisigSig
if noSig {
multisigInfo, err := client.LookupMultisigAccount(wh, stxn.Txn.Sender.String())
if err != nil {
reportErrorf(msigLookupError, err)
}
msig, err = msigInfoToMsig(multisigInfo)
if err != nil {
reportErrorf(msigParseError, err)
}
} else {
msig, err = client.MultisigSignTransactionWithWallet(wh, pw, stxn.Txn, addr, stxn.Msig)
if err != nil {
reportErrorf(errorSigningTX, err)
}
}

// The following line makes stxn.cachedEncodingLen incorrect, but it's okay because we're just serializing it to a file
Expand Down Expand Up @@ -181,11 +201,11 @@ var signProgramCmd = &cobra.Command{
}
multisigInfo, err := client.LookupMultisigAccount(wh, msigAddr)
if err != nil {
reportErrorf("could not lookup multisig address", err)
reportErrorf(msigLookupError, err)
}
msig, err := msigInfoToMsig(multisigInfo)
if err != nil {
reportErrorf("internal err processing msig: %s", err)
reportErrorf(msigParseError, err)
}
lsig.Msig = msig
}
Expand Down
4 changes: 4 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,10 @@ type Local struct {

// EnableRequestLogger enabled the logging of the incoming requests to the telemetry server.
EnableRequestLogger bool

// PeerConnectionsUpdateInterval defines the interval at which the peer connections information is being sent to the
// telemetry ( when enabled ). Defined in seconds.
PeerConnectionsUpdateInterval int
}

// Filenames of config files within the configdir (e.g. ~/.algorand)
Expand Down
7 changes: 6 additions & 1 deletion config/local_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ var defaultLocalV5 = Local{
TxSyncIntervalSeconds: 60,
TxSyncTimeoutSeconds: 30,
TxSyncServeResponseSize: 1000000,
PeerConnectionsUpdateInterval: 3600,
// DO NOT MODIFY VALUES - New values may be added carefully - See WARNING at top of file
}

Expand Down Expand Up @@ -138,6 +139,7 @@ var defaultLocalV4 = Local{
TxSyncIntervalSeconds: 60,
TxSyncTimeoutSeconds: 30,
TxSyncServeResponseSize: 1000000,

// DO NOT MODIFY VALUES - New values may be added carefully - See WARNING at top of file
}

Expand Down Expand Up @@ -347,7 +349,10 @@ func migrate(cfg Local) (newCfg Local, err error) {
if newCfg.CatchupParallelBlocks == defaultLocalV4.CatchupParallelBlocks {
newCfg.CatchupParallelBlocks = defaultLocalV5.CatchupParallelBlocks
}

if newCfg.PeerConnectionsUpdateInterval == defaultLocalV4.PeerConnectionsUpdateInterval {
newCfg.PeerConnectionsUpdateInterval = defaultLocalV5.PeerConnectionsUpdateInterval
}

newCfg.Version = 5
}

Expand Down
Loading