From c38a6f55b375c3f213e8acbd66f399d8a7b8ea70 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Mon, 15 May 2017 02:22:58 +0200 Subject: [PATCH 1/7] Prepare for codegen --- _gen.go | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 _gen.go diff --git a/_gen.go b/_gen.go new file mode 100644 index 000000000..36e39887f --- /dev/null +++ b/_gen.go @@ -0,0 +1,7 @@ +package main + +import ( + _ "github.com/tendermint/go-wire/data" + _ "github.com/clipperhouse/stringer" + _ "github.com/clipperhouse/set" +) From f16f71199218d8c0e7e9ef0284c361a51b258afd Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Mon, 15 May 2017 02:31:05 +0200 Subject: [PATCH 2/7] First code from codegen... wrong names --- pub_key.go | 47 +++----------------------------- pubkeyinner_holder.go | 62 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 43 deletions(-) create mode 100644 pubkeyinner_holder.go diff --git a/pub_key.go b/pub_key.go index 99839f288..a4da59d2f 100644 --- a/pub_key.go +++ b/pub_key.go @@ -7,9 +7,9 @@ import ( secp256k1 "github.com/btcsuite/btcd/btcec" "github.com/tendermint/ed25519" "github.com/tendermint/ed25519/extra25519" - . "github.com/tendermint/tmlibs/common" - data "github.com/tendermint/go-wire/data" "github.com/tendermint/go-wire" + data "github.com/tendermint/go-wire/data" + . "github.com/tendermint/tmlibs/common" "golang.org/x/crypto/ripemd160" ) @@ -20,12 +20,10 @@ func PubKeyFromBytes(pubKeyBytes []byte) (pubKey PubKey, err error) { //---------------------------------------- -type PubKey struct { - PubKeyInner `json:"unwrap"` -} - // DO NOT USE THIS INTERFACE. // You probably want to use PubKey + +// +gen holder:"PubKey,Impl[PubKeyEd25519,PubKeySecp256k1]" type PubKeyInner interface { AssertIsPubKeyInner() Address() []byte @@ -36,35 +34,6 @@ type PubKeyInner interface { Wrap() PubKey } -func (pk PubKey) MarshalJSON() ([]byte, error) { - return pubKeyMapper.ToJSON(pk.PubKeyInner) -} - -func (pk *PubKey) UnmarshalJSON(data []byte) (err error) { - parsed, err := pubKeyMapper.FromJSON(data) - if err == nil && parsed != nil { - pk.PubKeyInner = parsed.(PubKeyInner) - } - return -} - -// Unwrap recovers the concrete interface safely (regardless of levels of embeds) -func (pk PubKey) Unwrap() PubKeyInner { - pkI := pk.PubKeyInner - for wrap, ok := pkI.(PubKey); ok; wrap, ok = pkI.(PubKey) { - pkI = wrap.PubKeyInner - } - return pkI -} - -func (p PubKey) Empty() bool { - return p.PubKeyInner == nil -} - -var pubKeyMapper = data.NewMapper(PubKey{}). - RegisterImplementation(PubKeyEd25519{}, NameEd25519, TypeEd25519). - RegisterImplementation(PubKeySecp256k1{}, NameSecp256k1, TypeSecp256k1) - //------------------------------------- var _ PubKeyInner = PubKeyEd25519{} @@ -142,10 +111,6 @@ func (pubKey PubKeyEd25519) Equals(other PubKey) bool { } } -func (pubKey PubKeyEd25519) Wrap() PubKey { - return PubKey{pubKey} -} - //------------------------------------- var _ PubKeyInner = PubKeySecp256k1{} @@ -218,7 +183,3 @@ func (pubKey PubKeySecp256k1) Equals(other PubKey) bool { return false } } - -func (pubKey PubKeySecp256k1) Wrap() PubKey { - return PubKey{pubKey} -} diff --git a/pubkeyinner_holder.go b/pubkeyinner_holder.go new file mode 100644 index 000000000..16bfcf8a8 --- /dev/null +++ b/pubkeyinner_holder.go @@ -0,0 +1,62 @@ +// Generated by: main +// TypeWriter: holder +// Directive: +gen on PubKeyInner + +package crypto + +import ( + "github.com/tendermint/go-wire/data" +) + +// Auto-generated adapters for happily unmarshaling interfaces +// Apache License 2.0 +// Copyright (c) 2017 Ethan Frey (ethan.frey@tendermint.com) + +type PubKey struct { + PubKeyInner +} + +var PubKeyMapper = data.NewMapper(PubKey{}) + +func (h PubKey) MarshalJSON() ([]byte, error) { + return PubKeyMapper.ToJSON(h.PubKeyInner) +} + +func (h *PubKey) UnmarshalJSON(data []byte) (err error) { + parsed, err := PubKeyMapper.FromJSON(data) + if err == nil && parsed != nil { + h.PubKeyInner = parsed.(PubKeyInner) + } + return err +} + +// Unwrap recovers the concrete interface safely (regardless of levels of embeds) +func (h PubKey) Unwrap() PubKeyInner { + hi := h.PubKeyInner + for wrap, ok := hi.(PubKey); ok; wrap, ok = hi.(PubKey) { + hi = wrap.PubKeyInner + } + return hi +} + +func (h PubKey) Empty() bool { + return h.PubKeyInner == nil +} + +/*** below are bindings for each implementation ***/ + +func init() { + PubKeyMapper.RegisterImplementation(PubKeyEd25519{}, "pubkeyed25519", 0x1) +} + +func (hi PubKeyEd25519) Wrap() PubKey { + return PubKey{hi} +} + +func init() { + PubKeyMapper.RegisterImplementation(PubKeySecp256k1{}, "pubkeysecp256k1", 0x2) +} + +func (hi PubKeySecp256k1) Wrap() PubKey { + return PubKey{hi} +} From ee200d998fb42e23462569745c53c800fbdc6891 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Mon, 15 May 2017 02:46:28 +0200 Subject: [PATCH 3/7] Fix unwrap for proper json format --- encode_test.go | 4 ++-- pub_key.go | 3 +-- pubkeyinner_holder.go | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/encode_test.go b/encode_test.go index 6c5d03a1d..1b70d88ec 100644 --- a/encode_test.go +++ b/encode_test.go @@ -7,8 +7,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - data "github.com/tendermint/go-wire/data" wire "github.com/tendermint/go-wire" + data "github.com/tendermint/go-wire/data" ) type byter interface { @@ -58,7 +58,7 @@ func checkWireJSON(t *testing.T, in interface{}, reader interface{}, typ byte) { var err error js := wire.JSONBytes(in) btyp := fmt.Sprintf("[%d,", typ) - assert.True(t, strings.HasPrefix(string(js), btyp), string(js)) + assert.True(t, strings.HasPrefix(string(js), btyp), string(js), btyp) wire.ReadJSON(reader, js, &err) require.Nil(t, err, "%+v", err) diff --git a/pub_key.go b/pub_key.go index a4da59d2f..7483ff93a 100644 --- a/pub_key.go +++ b/pub_key.go @@ -22,8 +22,7 @@ func PubKeyFromBytes(pubKeyBytes []byte) (pubKey PubKey, err error) { // DO NOT USE THIS INTERFACE. // You probably want to use PubKey - -// +gen holder:"PubKey,Impl[PubKeyEd25519,PubKeySecp256k1]" +// +gen holder:"PubKey,Impl[PubKeyEd25519,PubKeySecp256k1],ed25519,secp256k1" type PubKeyInner interface { AssertIsPubKeyInner() Address() []byte diff --git a/pubkeyinner_holder.go b/pubkeyinner_holder.go index 16bfcf8a8..ee0ca9f00 100644 --- a/pubkeyinner_holder.go +++ b/pubkeyinner_holder.go @@ -13,7 +13,7 @@ import ( // Copyright (c) 2017 Ethan Frey (ethan.frey@tendermint.com) type PubKey struct { - PubKeyInner + PubKeyInner "json:\"unwrap\"" } var PubKeyMapper = data.NewMapper(PubKey{}) @@ -46,7 +46,7 @@ func (h PubKey) Empty() bool { /*** below are bindings for each implementation ***/ func init() { - PubKeyMapper.RegisterImplementation(PubKeyEd25519{}, "pubkeyed25519", 0x1) + PubKeyMapper.RegisterImplementation(PubKeyEd25519{}, "ed25519", 0x1) } func (hi PubKeyEd25519) Wrap() PubKey { @@ -54,7 +54,7 @@ func (hi PubKeyEd25519) Wrap() PubKey { } func init() { - PubKeyMapper.RegisterImplementation(PubKeySecp256k1{}, "pubkeysecp256k1", 0x2) + PubKeyMapper.RegisterImplementation(PubKeySecp256k1{}, "secp256k1", 0x2) } func (hi PubKeySecp256k1) Wrap() PubKey { From 746a2e286df37747cc00d60bd326f1c21e8aef02 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Mon, 15 May 2017 02:51:52 +0200 Subject: [PATCH 4/7] Codegen wrappers for privkey and signature as well --- priv_key.go | 46 ++--------------------------- privkeyinner_holder.go | 62 ++++++++++++++++++++++++++++++++++++++++ signature.go | 47 +++--------------------------- signatureinner_holder.go | 62 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 131 insertions(+), 86 deletions(-) create mode 100644 privkeyinner_holder.go create mode 100644 signatureinner_holder.go diff --git a/priv_key.go b/priv_key.go index 85f8a8ec4..056e50b55 100644 --- a/priv_key.go +++ b/priv_key.go @@ -6,9 +6,9 @@ import ( secp256k1 "github.com/btcsuite/btcd/btcec" "github.com/tendermint/ed25519" "github.com/tendermint/ed25519/extra25519" - . "github.com/tendermint/tmlibs/common" - data "github.com/tendermint/go-wire/data" "github.com/tendermint/go-wire" + data "github.com/tendermint/go-wire/data" + . "github.com/tendermint/tmlibs/common" ) func PrivKeyFromBytes(privKeyBytes []byte) (privKey PrivKey, err error) { @@ -18,12 +18,9 @@ func PrivKeyFromBytes(privKeyBytes []byte) (privKey PrivKey, err error) { //---------------------------------------- -type PrivKey struct { - PrivKeyInner `json:"unwrap"` -} - // DO NOT USE THIS INTERFACE. // You probably want to use PubKey +// +gen holder:"PrivKey,Impl[PrivKeyEd25519,PrivKeySecp256k1],ed25519,secp256k1" type PrivKeyInner interface { AssertIsPrivKeyInner() Bytes() []byte @@ -33,35 +30,6 @@ type PrivKeyInner interface { Wrap() PrivKey } -func (p PrivKey) MarshalJSON() ([]byte, error) { - return privKeyMapper.ToJSON(p.PrivKeyInner) -} - -func (p *PrivKey) UnmarshalJSON(data []byte) (err error) { - parsed, err := privKeyMapper.FromJSON(data) - if err == nil && parsed != nil { - p.PrivKeyInner = parsed.(PrivKeyInner) - } - return -} - -// Unwrap recovers the concrete interface safely (regardless of levels of embeds) -func (p PrivKey) Unwrap() PrivKeyInner { - pk := p.PrivKeyInner - for wrap, ok := pk.(PrivKey); ok; wrap, ok = pk.(PrivKey) { - pk = wrap.PrivKeyInner - } - return pk -} - -func (p PrivKey) Empty() bool { - return p.PrivKeyInner == nil -} - -var privKeyMapper = data.NewMapper(PrivKey{}). - RegisterImplementation(PrivKeyEd25519{}, NameEd25519, TypeEd25519). - RegisterImplementation(PrivKeySecp256k1{}, NameSecp256k1, TypeSecp256k1) - //------------------------------------- var _ PrivKeyInner = PrivKeyEd25519{} @@ -128,10 +96,6 @@ func (privKey PrivKeyEd25519) Generate(index int) PrivKeyEd25519 { return PrivKeyEd25519(newKey) } -func (privKey PrivKeyEd25519) Wrap() PrivKey { - return PrivKey{privKey} -} - func GenPrivKeyEd25519() PrivKeyEd25519 { privKeyBytes := new([64]byte) copy(privKeyBytes[:32], CRandBytes(32)) @@ -201,10 +165,6 @@ func (privKey PrivKeySecp256k1) String() string { return Fmt("PrivKeySecp256k1{*****}") } -func (privKey PrivKeySecp256k1) Wrap() PrivKey { - return PrivKey{privKey} -} - /* // Deterministically generates new priv-key bytes from key. func (key PrivKeySecp256k1) Generate(index int) PrivKeySecp256k1 { diff --git a/privkeyinner_holder.go b/privkeyinner_holder.go new file mode 100644 index 000000000..2621ca560 --- /dev/null +++ b/privkeyinner_holder.go @@ -0,0 +1,62 @@ +// Generated by: main +// TypeWriter: holder +// Directive: +gen on PrivKeyInner + +package crypto + +import ( + "github.com/tendermint/go-wire/data" +) + +// Auto-generated adapters for happily unmarshaling interfaces +// Apache License 2.0 +// Copyright (c) 2017 Ethan Frey (ethan.frey@tendermint.com) + +type PrivKey struct { + PrivKeyInner "json:\"unwrap\"" +} + +var PrivKeyMapper = data.NewMapper(PrivKey{}) + +func (h PrivKey) MarshalJSON() ([]byte, error) { + return PrivKeyMapper.ToJSON(h.PrivKeyInner) +} + +func (h *PrivKey) UnmarshalJSON(data []byte) (err error) { + parsed, err := PrivKeyMapper.FromJSON(data) + if err == nil && parsed != nil { + h.PrivKeyInner = parsed.(PrivKeyInner) + } + return err +} + +// Unwrap recovers the concrete interface safely (regardless of levels of embeds) +func (h PrivKey) Unwrap() PrivKeyInner { + hi := h.PrivKeyInner + for wrap, ok := hi.(PrivKey); ok; wrap, ok = hi.(PrivKey) { + hi = wrap.PrivKeyInner + } + return hi +} + +func (h PrivKey) Empty() bool { + return h.PrivKeyInner == nil +} + +/*** below are bindings for each implementation ***/ + +func init() { + PrivKeyMapper.RegisterImplementation(PrivKeyEd25519{}, "ed25519", 0x1) +} + +func (hi PrivKeyEd25519) Wrap() PrivKey { + return PrivKey{hi} +} + +func init() { + PrivKeyMapper.RegisterImplementation(PrivKeySecp256k1{}, "secp256k1", 0x2) +} + +func (hi PrivKeySecp256k1) Wrap() PrivKey { + return PrivKey{hi} +} diff --git a/signature.go b/signature.go index 36451ed48..12b584d71 100644 --- a/signature.go +++ b/signature.go @@ -4,9 +4,9 @@ import ( "bytes" "fmt" - . "github.com/tendermint/tmlibs/common" - data "github.com/tendermint/go-wire/data" "github.com/tendermint/go-wire" + data "github.com/tendermint/go-wire/data" + . "github.com/tendermint/tmlibs/common" ) func SignatureFromBytes(sigBytes []byte) (sig Signature, err error) { @@ -16,12 +16,9 @@ func SignatureFromBytes(sigBytes []byte) (sig Signature, err error) { //---------------------------------------- -type Signature struct { - SignatureInner `json:"unwrap"` -} - // DO NOT USE THIS INTERFACE. // You probably want to use Signature. +// +gen holder:"Signature,Impl[SignatureEd25519,SignatureSecp256k1],ed25519,secp256k1" type SignatureInner interface { AssertIsSignatureInner() Bytes() []byte @@ -31,35 +28,6 @@ type SignatureInner interface { Wrap() Signature } -func (sig Signature) MarshalJSON() ([]byte, error) { - return sigMapper.ToJSON(sig.SignatureInner) -} - -func (sig *Signature) UnmarshalJSON(data []byte) (err error) { - parsed, err := sigMapper.FromJSON(data) - if err == nil && parsed != nil { - sig.SignatureInner = parsed.(SignatureInner) - } - return -} - -// Unwrap recovers the concrete interface safely (regardless of levels of embeds) -func (sig Signature) Unwrap() SignatureInner { - pk := sig.SignatureInner - for wrap, ok := pk.(Signature); ok; wrap, ok = pk.(Signature) { - pk = wrap.SignatureInner - } - return pk -} - -func (sig Signature) Empty() bool { - return sig.SignatureInner == nil -} - -var sigMapper = data.NewMapper(Signature{}). - RegisterImplementation(SignatureEd25519{}, NameEd25519, TypeEd25519). - RegisterImplementation(SignatureSecp256k1{}, NameSecp256k1, TypeSecp256k1) - //------------------------------------- var _ SignatureInner = SignatureEd25519{} @@ -96,10 +64,6 @@ func (sig *SignatureEd25519) UnmarshalJSON(enc []byte) error { return err } -func (sig SignatureEd25519) Wrap() Signature { - return Signature{sig} -} - //------------------------------------- var _ SignatureInner = SignatureSecp256k1{} @@ -124,6 +88,7 @@ func (sig SignatureSecp256k1) Equals(other Signature) bool { return false } } + func (sig SignatureSecp256k1) MarshalJSON() ([]byte, error) { return data.Encoder.Marshal(sig) } @@ -131,7 +96,3 @@ func (sig SignatureSecp256k1) MarshalJSON() ([]byte, error) { func (sig *SignatureSecp256k1) UnmarshalJSON(enc []byte) error { return data.Encoder.Unmarshal((*[]byte)(sig), enc) } - -func (sig SignatureSecp256k1) Wrap() Signature { - return Signature{sig} -} diff --git a/signatureinner_holder.go b/signatureinner_holder.go new file mode 100644 index 000000000..cbe1fe093 --- /dev/null +++ b/signatureinner_holder.go @@ -0,0 +1,62 @@ +// Generated by: main +// TypeWriter: holder +// Directive: +gen on SignatureInner + +package crypto + +import ( + "github.com/tendermint/go-wire/data" +) + +// Auto-generated adapters for happily unmarshaling interfaces +// Apache License 2.0 +// Copyright (c) 2017 Ethan Frey (ethan.frey@tendermint.com) + +type Signature struct { + SignatureInner "json:\"unwrap\"" +} + +var SignatureMapper = data.NewMapper(Signature{}) + +func (h Signature) MarshalJSON() ([]byte, error) { + return SignatureMapper.ToJSON(h.SignatureInner) +} + +func (h *Signature) UnmarshalJSON(data []byte) (err error) { + parsed, err := SignatureMapper.FromJSON(data) + if err == nil && parsed != nil { + h.SignatureInner = parsed.(SignatureInner) + } + return err +} + +// Unwrap recovers the concrete interface safely (regardless of levels of embeds) +func (h Signature) Unwrap() SignatureInner { + hi := h.SignatureInner + for wrap, ok := hi.(Signature); ok; wrap, ok = hi.(Signature) { + hi = wrap.SignatureInner + } + return hi +} + +func (h Signature) Empty() bool { + return h.SignatureInner == nil +} + +/*** below are bindings for each implementation ***/ + +func init() { + SignatureMapper.RegisterImplementation(SignatureEd25519{}, "ed25519", 0x1) +} + +func (hi SignatureEd25519) Wrap() Signature { + return Signature{hi} +} + +func init() { + SignatureMapper.RegisterImplementation(SignatureSecp256k1{}, "secp256k1", 0x2) +} + +func (hi SignatureSecp256k1) Wrap() Signature { + return Signature{hi} +} From 79c580492e6b8658605c8ceea5f6bc52739d0339 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Mon, 15 May 2017 15:56:08 +0200 Subject: [PATCH 5/7] add make codegen for gen --- Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 59440fe66..d453f7ad1 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONEY: all docs test install get_vendor_deps ensure_tools +.PHONEY: all docs test install get_vendor_deps ensure_tools codegen GOTOOLS = \ github.com/Masterminds/glide @@ -24,4 +24,12 @@ get_vendor_deps: ensure_tools ensure_tools: go get $(GOTOOLS) +prepgen: install + cd ../go-wire && make tools + go install ./vendor/github.com/btcsuite/btcutil/base58 + go install ./vendor/github.com/stretchr/testify/assert + go install ./vendor/github.com/stretchr/testify/require + go install ./vendor/golang.org/x/crypto/bcrypt +codegen: prepgen + gen From bee63ce4ff15b8d48a0ee6fa9d902775f86fa1a1 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Mon, 15 May 2017 19:13:49 +0200 Subject: [PATCH 6/7] Cleaned up build process, moved codegen to separate package in go-wire --- Makefile | 7 ++++--- _gen.go | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d453f7ad1..ca9703399 100644 --- a/Makefile +++ b/Makefile @@ -25,11 +25,12 @@ ensure_tools: go get $(GOTOOLS) prepgen: install - cd ../go-wire && make tools go install ./vendor/github.com/btcsuite/btcutil/base58 go install ./vendor/github.com/stretchr/testify/assert go install ./vendor/github.com/stretchr/testify/require go install ./vendor/golang.org/x/crypto/bcrypt -codegen: prepgen - gen +codegen: + @echo "--> regenerating all interface wrappers" + @gen + @echo "Done!" diff --git a/_gen.go b/_gen.go index 36e39887f..a98feaf4e 100644 --- a/_gen.go +++ b/_gen.go @@ -1,7 +1,6 @@ package main import ( - _ "github.com/tendermint/go-wire/data" + _ "github.com/tendermint/go-wire/gen" _ "github.com/clipperhouse/stringer" - _ "github.com/clipperhouse/set" ) From db5cb8d92c3e993786f406e9fcfebbbd60bd2d87 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Tue, 16 May 2017 16:59:40 +0200 Subject: [PATCH 7/7] Change codegen name holder->wrapper --- glide.lock | 2 +- priv_key.go | 2 +- privkeyinner_holder.go => privkeyinner_wrapper.go | 2 +- pub_key.go | 2 +- pubkeyinner_holder.go => pubkeyinner_wrapper.go | 2 +- signature.go | 2 +- signatureinner_holder.go => signatureinner_wrapper.go | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) rename privkeyinner_holder.go => privkeyinner_wrapper.go (98%) rename pubkeyinner_holder.go => pubkeyinner_wrapper.go (98%) rename signatureinner_holder.go => signatureinner_wrapper.go (98%) diff --git a/glide.lock b/glide.lock index 1f026ceb9..82dd5111e 100644 --- a/glide.lock +++ b/glide.lock @@ -88,7 +88,7 @@ imports: - edwards25519 - extra25519 - name: github.com/tendermint/go-wire - version: 59ba5af720a8cbaf5594595e1d8aae23bfd18e31 + version: 97beaedf0f4dbc035309157c92be3b30cc6e5d74 subpackages: - data - data/base58 diff --git a/priv_key.go b/priv_key.go index 056e50b55..0c6bd2ae7 100644 --- a/priv_key.go +++ b/priv_key.go @@ -20,7 +20,7 @@ func PrivKeyFromBytes(privKeyBytes []byte) (privKey PrivKey, err error) { // DO NOT USE THIS INTERFACE. // You probably want to use PubKey -// +gen holder:"PrivKey,Impl[PrivKeyEd25519,PrivKeySecp256k1],ed25519,secp256k1" +// +gen wrapper:"PrivKey,Impl[PrivKeyEd25519,PrivKeySecp256k1],ed25519,secp256k1" type PrivKeyInner interface { AssertIsPrivKeyInner() Bytes() []byte diff --git a/privkeyinner_holder.go b/privkeyinner_wrapper.go similarity index 98% rename from privkeyinner_holder.go rename to privkeyinner_wrapper.go index 2621ca560..05ce69672 100644 --- a/privkeyinner_holder.go +++ b/privkeyinner_wrapper.go @@ -1,5 +1,5 @@ // Generated by: main -// TypeWriter: holder +// TypeWriter: wrapper // Directive: +gen on PrivKeyInner package crypto diff --git a/pub_key.go b/pub_key.go index 7483ff93a..4d5c31b21 100644 --- a/pub_key.go +++ b/pub_key.go @@ -22,7 +22,7 @@ func PubKeyFromBytes(pubKeyBytes []byte) (pubKey PubKey, err error) { // DO NOT USE THIS INTERFACE. // You probably want to use PubKey -// +gen holder:"PubKey,Impl[PubKeyEd25519,PubKeySecp256k1],ed25519,secp256k1" +// +gen wrapper:"PubKey,Impl[PubKeyEd25519,PubKeySecp256k1],ed25519,secp256k1" type PubKeyInner interface { AssertIsPubKeyInner() Address() []byte diff --git a/pubkeyinner_holder.go b/pubkeyinner_wrapper.go similarity index 98% rename from pubkeyinner_holder.go rename to pubkeyinner_wrapper.go index ee0ca9f00..7b36c324d 100644 --- a/pubkeyinner_holder.go +++ b/pubkeyinner_wrapper.go @@ -1,5 +1,5 @@ // Generated by: main -// TypeWriter: holder +// TypeWriter: wrapper // Directive: +gen on PubKeyInner package crypto diff --git a/signature.go b/signature.go index 12b584d71..1c5b8d69e 100644 --- a/signature.go +++ b/signature.go @@ -18,7 +18,7 @@ func SignatureFromBytes(sigBytes []byte) (sig Signature, err error) { // DO NOT USE THIS INTERFACE. // You probably want to use Signature. -// +gen holder:"Signature,Impl[SignatureEd25519,SignatureSecp256k1],ed25519,secp256k1" +// +gen wrapper:"Signature,Impl[SignatureEd25519,SignatureSecp256k1],ed25519,secp256k1" type SignatureInner interface { AssertIsSignatureInner() Bytes() []byte diff --git a/signatureinner_holder.go b/signatureinner_wrapper.go similarity index 98% rename from signatureinner_holder.go rename to signatureinner_wrapper.go index cbe1fe093..1fdd790d6 100644 --- a/signatureinner_holder.go +++ b/signatureinner_wrapper.go @@ -1,5 +1,5 @@ // Generated by: main -// TypeWriter: holder +// TypeWriter: wrapper // Directive: +gen on SignatureInner package crypto