test-tube icon indicating copy to clipboard operation
test-tube copied to clipboard

ForceExecuteGovProposal

Open iboss-ptk opened this issue 1 year ago • 0 comments

The idea here is to allow governance gated execution without voting in test.

Here is some implementation idea on go side:

// libosmosistesttube/main.go

//export ForceExecuteGovProposal
func ForceExecuteGovProposal(envId uint64, path, proposalTypeUrl, base64ProposalBytes string) *C.char {
	env := loadEnv(envId)

	// get router 
	govRouter := govkeeper.Keeper.Router(*env.App.GovKeeper)

	// unmarshal content from base64ProposalBytes and proposalTypeUrl
        // every proposal type implement `Content` interface
	// we might need to create a proposal type registry to fetch the correct type to unmarshal
	// but if you find a way to unmarshal without registry, that would be better
	content = ...
	err := govRouter.GetRoute(path)(env.Ctx, content)

	if err {
		return encodeErrToResultBytes(result.ExecuteError, err)
	}

	return encodeBytesResultBytes([]byte{})
}

iboss-ptk avatar Apr 05 '23 12:04 iboss-ptk