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

Unregistered interface types.Evidence #4843

Closed
4 tasks
whunmr opened this issue Aug 5, 2019 · 1 comment · Fixed by #4846
Closed
4 tasks

Unregistered interface types.Evidence #4843

whunmr opened this issue Aug 5, 2019 · 1 comment · Fixed by #4846

Comments

@whunmr
Copy link

whunmr commented Aug 5, 2019

Summary of Bug

Got Unregistered interface types.Evidence in response of rest-api blocks/latest
when latest block contains DuplicateVoteEvidence in our chain.

Version

v0.36.0-rc1

Steps to Reproduce

{
    "error": "Unregistered interface types.Evidence"
}

tests

Maybe we should add RegisterEvidences(cdc) in codec/codec.go:54

func init() {
	cdc := New()
	RegisterCrypto(cdc)
	Cdc = cdc.Seal()
}

Got same error in following tests, and the test can pass if we add RegisterEvidences(cdc) in init()

type Codec = amino.Codec
var My *Codec
func New() *Codec {
	return amino.NewCodec()
}

func RegisterCrypto(cdc *Codec) {
	cryptoAmino.RegisterAmino(cdc)
}
var Cdc *Codec
func init() {
	cdc := New()
	RegisterCrypto(cdc)
	//RegisterEvidences(cdc)
	Cdc = cdc.Seal()
}

func TestEvidenceList(t *testing.T) {
	ev := randomDuplicatedVoteEvidence()
	evl := EvidenceList([]Evidence{ev})

	assert.NotNil(t, evl.Hash())
	assert.True(t, evl.Has(ev))
	assert.False(t, evl.Has(&DuplicateVoteEvidence{}))

	x := Cdc.MustMarshalJSON(evl)
	fmt.Println(string(x))
}

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@alexanderbez
Copy link
Contributor

Yes, good catch @whunmr. We should add a proxy call in codec.go which calls Tendermint's evidence.RegisterEvidences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants