Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

basecli AppTx - Signer should be added when reading flags #132

Closed
rigelrozanski opened this issue Jun 22, 2017 · 4 comments
Closed

basecli AppTx - Signer should be added when reading flags #132

rigelrozanski opened this issue Jun 22, 2017 · 4 comments
Assignees

Comments

@rigelrozanski
Copy link
Contributor

Plugins sometimes require the signer address to function properly. This address should be returned in the TxInput of AppTx when returned from AppTx Helper command ReadAppTxFlags(). Right now signers are added later before broadcast in the BroadcastAppTx as a part of the AddSigner function. This can simply removed after its been added to ReadAppTxFlags()

https://github.com/tendermint/basecoin/blob/develop/cmd/basecli/commands/cmds.go#L148

@ethanfrey
Copy link
Contributor

Please show me the code in trackomatron where this is causing a problem.

The signer comes from checking the key manager, tried to handle that all in one step, but I guess I could split it up in two parts if it's better. Just want to see a concrete problem with the current structure.

@rigelrozanski
Copy link
Contributor Author

https://github.com/tendermint/trackomatron/blob/f257a5d3f146c5c8d6097a129f19bc5a402a6a9d/cmd/trackocli/tx/profile.go#L67-L102

        gas, fee, txInput, err := bcmd.ReadAppTxFlags()
	if err != nil {
		return err
	}

	// Retrieve the app-specific flags/args
	var name string
	if TBTx == invoicer.TBTxProfileOpen {
		if len(args) != 1 {
			return trcmn.ErrCmdReqArg("name")
		}
		name = args[0]
	}

	//TODO get the address here from txInput once changed in basecoin
	data := profileTx(TBTx, txcmd.GetSigner().Address(), name)

	// Create AppTx and broadcast
	tx := &btypes.AppTx{
		Gas:   gas,
		Fee:   fee,
		Name:  invoicer.Name,
		Input: txInput,
		Data:  data,
	}
	res, err := bcmd.BroadcastAppTx(tx)
	if err != nil {
		return err
	}

Within any trackomatron profile is linked to a basecoin pubkey address, aka this information needs to be sent in with the transaction in order to be interpreted used on the server-side processing. Right now, as shown in the above code, we generate the txInput before we generate the custom plugin tx bytes (which need the address). Within the txInput there is a field for the address and the pubkey however, they are left empty at generation and only filled in later in the AddSigner function which is a part of BroadcastAppTx which is called here... but this is after generating the txInput... I have a workaround right now which is to just the signer directly as I've done here, it's just unnecessary we should only need to call the function once.. not to mention that it's confusing that those fields exist but they're just not filled in... Makes sense?

@ethanfrey
Copy link
Contributor

Yeah, I figured all this info could be filled in at the last step.

Now I realize, we need to actually build some opaque []byte for the app, which will need this info. So this doesn't work.

Sure, pull it out.

My thought was a bit that light-client needs to support unsigned tx to work with dummy / merkleeyes / other example apps. So I didn't make the signing name fully required from the get-go. But clearly in basecoin, it is always required. I just didn't change my thinking.

Yes, please do the Signer / sig stuff early on here, as it is always needed.

@ethanfrey
Copy link
Contributor

Closed with #140

alexanderbez added a commit that referenced this issue May 26, 2022
* fix testing and protobuf related issues

* remove unnecessary changes in legacy migration tests

* remove extraneous comments

* add test for minselfdelegation

* fix: Ensure that MsgCreateValidator's accompanying delegation is at least the provided MinSelfDelegation (#132)

* add check to make sure validator object is only created if min delegation threshold is met

* fix check location and use standard error type

* fix logic for check

* add test for new check

* update test comments for better context

* add checks for global min self delegation and fix corresponding tests

* add migration code

* fix migration code tests

* fix staking client unit tests

* tidy up

* Apply suggestions from code review

Co-authored-by: Dev Ojha <[email protected]>
Co-authored-by: Aleksandr Bezobchuk <[email protected]>

* apply changes suggested in review

* fixed edge case error

* lint++

* lint++

* Update x/staking/keeper/msg_server.go

* Update x/staking/keeper/msg_server.go

* Update x/staking/keeper/msg_server.go

Co-authored-by: Aleksandr Bezobchuk <[email protected]>

Co-authored-by: Aleksandr Bezobchuk <[email protected]>
Co-authored-by: Dev Ojha <[email protected]>
Co-authored-by: Aleksandr Bezobchuk <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants