diff --git a/app/app.go b/app/app.go index d123548a..14706953 100644 --- a/app/app.go +++ b/app/app.go @@ -865,7 +865,7 @@ func NewApp( pvKeyFile := filepath.Join(homePath, cast.ToString(appOpts.Get("priv_validator_key_file"))) vrfKeyFile := utils.PrivValidatorKeyFileToVRFKeyFile(pvKeyFile) vrfKey, err := utils.LoadVRFKey(vrfKeyFile) - if vrfKey == nil || err != nil { + if err != nil { // TO-DO if validator, panic app.Logger().Info("failed to load vrf key") if err != nil { diff --git a/app/utils/vrf_key.go b/app/utils/vrf_key.go index 14704082..d71cca0d 100644 --- a/app/utils/vrf_key.go +++ b/app/utils/vrf_key.go @@ -2,7 +2,6 @@ package utils import ( "bytes" - "context" "fmt" "os" "path/filepath" @@ -146,7 +145,7 @@ func (v *VRFKey) SignTransaction( } bytesToSign, err := authsigning.GetSignBytesAdapter( - context.Background(), + ctx, txConfig.SignModeHandler(), signMode, signerData, @@ -239,7 +238,7 @@ func LoadVRFKey(keyFilePath string) (*VRFKey, error) { func InitializeVRFKey(config *cfg.Config) (vrfPubKey sdkcrypto.PubKey, err error) { pvKeyFile := config.PrivValidatorKeyFile() - if err := os.MkdirAll(filepath.Dir(pvKeyFile), 0o777); err != nil { + if err := os.MkdirAll(filepath.Dir(pvKeyFile), 0o755); err != nil { return nil, fmt.Errorf("could not create directory %q: %w", filepath.Dir(pvKeyFile), err) } diff --git a/x/randomness/keeper/abci.go b/x/randomness/keeper/abci.go index 386e5626..41f812cf 100644 --- a/x/randomness/keeper/abci.go +++ b/x/randomness/keeper/abci.go @@ -86,10 +86,10 @@ func (h *ProposalHandler) PrepareProposalHandler( stop := h.txSelector.SelectTxForProposal(ctx, uint64(req.MaxTxBytes), maxBlockGas, newSeedTx, newSeedTxBz) if stop { - return nil, fmt.Errorf("max block gas exceeded by just new seed tx") + return nil, fmt.Errorf("max block gas or tx bytes exceeded by just new seed tx") } - // perform mandatory checks on the other txs + // include txs in the proposal until max tx bytes or block gas limits are reached for _, txBz := range req.Txs { tx, err := h.txVerifier.TxDecode(txBz) if err != nil { @@ -235,7 +235,11 @@ func generateAndSignNewSeedTx(ctx sdk.Context, txConfig client.TxConfig, vrfSign txsigning.SignMode_SIGN_MODE_DIRECT, account, ) - if err := txBuilder.SetSignatures(sig); err != nil { + if err != nil { + return nil, nil, err + } + err = txBuilder.SetSignatures(sig) + if err != nil { return nil, nil, err } diff --git a/x/staking/client/cli/tx.go b/x/staking/client/cli/tx.go index 1c836b1f..cb02fe75 100644 --- a/x/staking/client/cli/tx.go +++ b/x/staking/client/cli/tx.go @@ -171,8 +171,7 @@ type TxCreateValidatorConfig struct { } func BuildCreateValidatorWithVRFMsg(clientCtx client.Context, config TxCreateValidatorConfig, txBldr tx.Factory, generateOnly bool, valCodec address.Codec) (tx.Factory, sdk.Msg, error) { - amounstStr := config.Amount - amount, err := sdk.ParseCoinNormalized(amounstStr) + amount, err := sdk.ParseCoinNormalized(config.Amount) if err != nil { return txBldr, nil, err } diff --git a/x/staking/types/msg.go b/x/staking/types/msg.go index 9de45f95..d6c2c9ae 100644 --- a/x/staking/types/msg.go +++ b/x/staking/types/msg.go @@ -17,8 +17,7 @@ var ( _ codectypes.UnpackInterfacesMessage = (*MsgCreateValidatorWithVRF)(nil) ) -// NewMsgCreateValidator creates a new MsgCreateValidator instance. -// Delegator address and validator address are the same. +// NewMsgCreateValidatorWithVRF creates a MsgCreateValidatorWithVRF instance. func NewMsgCreateValidatorWithVRF( valAddr string, pubKey cryptotypes.PubKey, vrfPubKey cryptotypes.PubKey, selfDelegation sdk.Coin, description types.Description, commission types.CommissionRates, minSelfDelegation math.Int,