Skip to content

Commit

Permalink
Add ExtrinsicSignatureV5 (centrifuge#68)
Browse files Browse the repository at this point in the history
* Adds ExtrinsicSignatureV5

* Remove print

* fix error 1

* Fix test

Co-authored-by: Miguel Hervas <[email protected]>
  • Loading branch information
ansermino and mikiquantum authored Apr 7, 2020
1 parent 8080cdb commit 461cf42
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion rpc/author/author_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ func (s *MockSrv) PendingExtrinsics() []string {
// config.Default().RPCURL
var mockSrv = MockSrv{
submitExtrinsicHash: "0x9a8ef9794ded03b4d1ae45034351210e87f970f1f9500994bca82f9cd5a1166e",
pendingExtrinsics: []string{"0x290284ffd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d00a023bbe883405b5fac2aa114093fcf3d0802d2f3d3715e09129b00a4bf741048caf53d8c7d97e872caa703e7d04f174a4e2ed4acadee4173a8b6bab7e45c0a06000c000600ff8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48e56c"}, //nolint:lll
pendingExtrinsics: []string{"0x290284d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d01a04a45593112549bb7ba4d379c2df140a2f8e206aac15c1c83ed0ff6e836ad6be259c490327a35a79044c9ed33ad5754e09586445eb28d752f9a23ba95d8f9800000000500ff8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48e56c"}, //nolint:lll
}
2 changes: 1 addition & 1 deletion rpc/author/pending_extrinsics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ import (
func TestAuthor_PendingExtrinsics(t *testing.T) {
res, err := author.PendingExtrinsics()
assert.NoError(t, err)
assert.Equal(t, []types.Extrinsic{types.Extrinsic{Version: 0x84, Signature: types.ExtrinsicSignatureV4{Signer: types.Address{IsAccountID: true, AsAccountID: types.AccountID{0xd4, 0x35, 0x93, 0xc7, 0x15, 0xfd, 0xd3, 0x1c, 0x61, 0x14, 0x1a, 0xbd, 0x4, 0xa9, 0x9f, 0xd6, 0x82, 0x2c, 0x85, 0x58, 0x85, 0x4c, 0xcd, 0xe3, 0x9a, 0x56, 0x84, 0xe7, 0xa5, 0x6d, 0xa2, 0x7d}, IsAccountIndex: false, AsAccountIndex: 0x0}, Signature: types.MultiSignature{IsEd25519: true, AsEd25519: types.Signature{0xa0, 0x23, 0xbb, 0xe8, 0x83, 0x40, 0x5b, 0x5f, 0xac, 0x2a, 0xa1, 0x14, 0x9, 0x3f, 0xcf, 0x3d, 0x8, 0x2, 0xd2, 0xf3, 0xd3, 0x71, 0x5e, 0x9, 0x12, 0x9b, 0x0, 0xa4, 0xbf, 0x74, 0x10, 0x48, 0xca, 0xf5, 0x3d, 0x8c, 0x7d, 0x97, 0xe8, 0x72, 0xca, 0xa7, 0x3, 0xe7, 0xd0, 0x4f, 0x17, 0x4a, 0x4e, 0x2e, 0xd4, 0xac, 0xad, 0xee, 0x41, 0x73, 0xa8, 0xb6, 0xba, 0xb7, 0xe4, 0x5c, 0xa, 0x6}, IsSr25519: false, AsSr25519: types.Signature{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, IsEcdsa: false, AsEcdsa: types.Bytes(nil)}, Era: types.ExtrinsicEra{IsImmortalEra: true, IsMortalEra: false, AsMortalEra: types.MortalEra{First: 0x0, Second: 0x0}}, Nonce: 0x3, Tip: 0x0}, Method: types.Call{CallIndex: types.CallIndex{SectionIndex: 0x6, MethodIndex: 0x0}, Args: types.Args{0xff, 0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48, 0xe5, 0x6c}}}}, res) //nolint:lll,dupl
assert.Equal(t, []types.Extrinsic{types.Extrinsic{Version:0x84, Signature:types.ExtrinsicSignatureV5{Signer:types.AccountID{0xd4, 0x35, 0x93, 0xc7, 0x15, 0xfd, 0xd3, 0x1c, 0x61, 0x14, 0x1a, 0xbd, 0x4, 0xa9, 0x9f, 0xd6, 0x82, 0x2c, 0x85, 0x58, 0x85, 0x4c, 0xcd, 0xe3, 0x9a, 0x56, 0x84, 0xe7, 0xa5, 0x6d, 0xa2, 0x7d}, Signature:types.MultiSignature{IsEd25519:false, AsEd25519:types.Signature{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, IsSr25519:true, AsSr25519:types.Signature{0xa0, 0x4a, 0x45, 0x59, 0x31, 0x12, 0x54, 0x9b, 0xb7, 0xba, 0x4d, 0x37, 0x9c, 0x2d, 0xf1, 0x40, 0xa2, 0xf8, 0xe2, 0x6, 0xaa, 0xc1, 0x5c, 0x1c, 0x83, 0xed, 0xf, 0xf6, 0xe8, 0x36, 0xad, 0x6b, 0xe2, 0x59, 0xc4, 0x90, 0x32, 0x7a, 0x35, 0xa7, 0x90, 0x44, 0xc9, 0xed, 0x33, 0xad, 0x57, 0x54, 0xe0, 0x95, 0x86, 0x44, 0x5e, 0xb2, 0x8d, 0x75, 0x2f, 0x9a, 0x23, 0xba, 0x95, 0xd8, 0xf9, 0x80}, IsEcdsa:false, AsEcdsa:types.Bytes(nil)}, Era:types.ExtrinsicEra{IsImmortalEra:true, IsMortalEra:false, AsMortalEra:types.MortalEra{First:0x0, Second:0x0}}, Nonce:0x0, Tip:0x0}, Method:types.Call{CallIndex:types.CallIndex{SectionIndex:0x5, MethodIndex:0x0}, Args:types.Args{0xff, 0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48, 0xe5, 0x6c}}}}, res) //nolint:lll,dupl
}
2 changes: 1 addition & 1 deletion rpc/author/submit_extrinsic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
)

func TestAuthor_SubmitExtrinsic(t *testing.T) {
ext := types.Extrinsic{Version: 0x84, Signature: types.ExtrinsicSignatureV4{Signer: types.Address{IsAccountID: true, AsAccountID: types.AccountID{0xd4, 0x35, 0x93, 0xc7, 0x15, 0xfd, 0xd3, 0x1c, 0x61, 0x14, 0x1a, 0xbd, 0x4, 0xa9, 0x9f, 0xd6, 0x82, 0x2c, 0x85, 0x58, 0x85, 0x4c, 0xcd, 0xe3, 0x9a, 0x56, 0x84, 0xe7, 0xa5, 0x6d, 0xa2, 0x7d}, IsAccountIndex: false, AsAccountIndex: 0x0}, Signature: types.MultiSignature{IsSr25519: true, AsSr25519: types.Signature{0xc0, 0x42, 0x19, 0x5f, 0x93, 0x25, 0xd, 0x3e, 0xda, 0xa2, 0xe4, 0xa4, 0x2d, 0xcf, 0x4e, 0x41, 0xc1, 0x6c, 0xa7, 0x1c, 0xfc, 0x3a, 0x2b, 0x23, 0x99, 0x8a, 0xd4, 0xec, 0x97, 0x4f, 0x8b, 0x1a, 0xcd, 0xcd, 0xad, 0x97, 0xd1, 0x4b, 0x6d, 0xf5, 0xcb, 0x89, 0x6, 0xff, 0x61, 0xc8, 0x92, 0x17, 0x96, 0x54, 0xa5, 0xec, 0xcc, 0xb, 0x66, 0x85, 0xf6, 0xc1, 0x7f, 0xed, 0x49, 0x21, 0x94, 0x0}}, Era: types.ExtrinsicEra{IsImmortalEra: true, IsMortalEra: false, AsMortalEra: types.MortalEra{First: 0x0, Second: 0x0}}, Nonce: 0x1, Tip: 0x0}, Method: types.Call{CallIndex: types.CallIndex{SectionIndex: 0x6, MethodIndex: 0x0}, Args: types.Args{0xff, 0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48, 0xe5, 0x6c}}} //nolint:lll,dupl
ext := types.Extrinsic{Version: 0x84, Signature: types.ExtrinsicSignatureV5{Signer: types.AccountID{0xd4, 0x35, 0x93, 0xc7, 0x15, 0xfd, 0xd3, 0x1c, 0x61, 0x14, 0x1a, 0xbd, 0x4, 0xa9, 0x9f, 0xd6, 0x82, 0x2c, 0x85, 0x58, 0x85, 0x4c, 0xcd, 0xe3, 0x9a, 0x56, 0x84, 0xe7, 0xa5, 0x6d, 0xa2, 0x7d}, Signature: types.MultiSignature{IsSr25519: true, AsSr25519: types.Signature{0xc0, 0x42, 0x19, 0x5f, 0x93, 0x25, 0xd, 0x3e, 0xda, 0xa2, 0xe4, 0xa4, 0x2d, 0xcf, 0x4e, 0x41, 0xc1, 0x6c, 0xa7, 0x1c, 0xfc, 0x3a, 0x2b, 0x23, 0x99, 0x8a, 0xd4, 0xec, 0x97, 0x4f, 0x8b, 0x1a, 0xcd, 0xcd, 0xad, 0x97, 0xd1, 0x4b, 0x6d, 0xf5, 0xcb, 0x89, 0x6, 0xff, 0x61, 0xc8, 0x92, 0x17, 0x96, 0x54, 0xa5, 0xec, 0xcc, 0xb, 0x66, 0x85, 0xf6, 0xc1, 0x7f, 0xed, 0x49, 0x21, 0x94, 0x0}}, Era: types.ExtrinsicEra{IsImmortalEra: true, IsMortalEra: false, AsMortalEra: types.MortalEra{First: 0x0, Second: 0x0}}, Nonce: 0x1, Tip: 0x0}, Method: types.Call{CallIndex: types.CallIndex{SectionIndex: 0x6, MethodIndex: 0x0}, Args: types.Args{0xff, 0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48, 0xe5, 0x6c}}} //nolint:lll,dupl

res, err := author.SubmitExtrinsic(ext)
assert.NoError(t, err)
Expand Down
4 changes: 1 addition & 3 deletions rpc/state/get_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
package state

import (
"fmt"

"github.com/centrifuge/go-substrate-rpc-client/client"
"github.com/centrifuge/go-substrate-rpc-client/types"
)
Expand All @@ -30,7 +28,7 @@ func (s *State) GetStorage(key types.StorageKey, target interface{}, blockHash t
if err != nil {
return false, err
}
fmt.Printf("%#v", raw)

if len(*raw) == 0 {
return false, nil
}
Expand Down
6 changes: 3 additions & 3 deletions signature/signature.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func Sign(data []byte, privateKeyURI string) ([]byte, error) {

// Verify verifies data using the provided signature and the key under the derivation path. Requires the subkey
// command to be in path
func Verify(data []byte, sig []byte, privateKeyURI string) (bool, error) {
func Verify(data []byte, sig []byte, publicIdentifier string) (bool, error) {
// if data is longer than 256 bytes, hash it first
if len(data) > 256 {
h := blake2b.Sum256(data)
Expand All @@ -138,13 +138,13 @@ func Verify(data []byte, sig []byte, privateKeyURI string) (bool, error) {
sigHex := hex.EncodeToString(sig)

// use "subkey" command for signature
cmd := exec.Command(subkeyCmd, "verify", sigHex, privateKeyURI, "--hex")
cmd := exec.Command(subkeyCmd, "verify", sigHex, publicIdentifier, "--hex")

// data to stdin
dataHex := hex.EncodeToString(data)
cmd.Stdin = strings.NewReader(dataHex)

// log.Printf("echo -n \"%v\" | %v verify %v %v --hex", dataHex, subkeyCmd, sigHex, privateKeyURI)
// log.Printf("echo -n \"%v\" | %v verify %v %v --hex", dataHex, subkeyCmd, sigHex, publicIdentifier)

// execute the command, get the output
out, err := cmd.Output()
Expand Down
4 changes: 2 additions & 2 deletions signature/signature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestSignAndVerify(t *testing.T) {
sig, err := Sign(data, TestKeyringPairAlice.URI)
assert.NoError(t, err)

ok, err := Verify(data, sig, TestKeyringPairAlice.URI)
ok, err := Verify(data, sig, TestKeyringPairAlice.Address)
assert.NoError(t, err)

assert.True(t, ok)
Expand All @@ -72,7 +72,7 @@ func TestSignAndVerifyLong(t *testing.T) {
sig, err := Sign(data, TestKeyringPairAlice.URI)
assert.NoError(t, err)

ok, err := Verify(data, sig, TestKeyringPairAlice.URI)
ok, err := Verify(data, sig, TestKeyringPairAlice.Address)
assert.NoError(t, err)

assert.True(t, ok)
Expand Down
6 changes: 3 additions & 3 deletions types/extrinsic.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type Extrinsic struct {
// Version is the encoded version flag (which encodes the raw transaction version and signing information in one byte)
Version byte
// Signature is the ExtrinsicSignatureV4, it's presence depends on the Version flag
Signature ExtrinsicSignatureV4
Signature ExtrinsicSignatureV5
// Method is the call this extrinsic wraps
Method Call
}
Expand Down Expand Up @@ -150,8 +150,8 @@ func (e *Extrinsic) Sign(signer signature.KeyringPair, o SignatureOptions) error
return err
}

extSig := ExtrinsicSignatureV4{
Signer: signerPubKey,
extSig := ExtrinsicSignatureV5{
Signer: signerPubKey.AsAccountID,
Signature: MultiSignature{IsSr25519: true, AsSr25519: sig},
Era: era,
Nonce: o.Nonce,
Expand Down
2 changes: 1 addition & 1 deletion types/extrinsic_examplary.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

package types

var ExamplaryExtrinsic = Extrinsic{Version: 0x84, Signature: ExtrinsicSignatureV4{Signer: Address{IsAccountID: true, AsAccountID: AccountID{0xd4, 0x35, 0x93, 0xc7, 0x15, 0xfd, 0xd3, 0x1c, 0x61, 0x14, 0x1a, 0xbd, 0x4, 0xa9, 0x9f, 0xd6, 0x82, 0x2c, 0x85, 0x58, 0x85, 0x4c, 0xcd, 0xe3, 0x9a, 0x56, 0x84, 0xe7, 0xa5, 0x6d, 0xa2, 0x7d}, IsAccountIndex: false, AsAccountIndex: 0x0}, Signature: MultiSignature{IsSr25519: true, AsSr25519: Signature{0x5c, 0x77, 0x1d, 0xd5, 0x6a, 0xe0, 0xce, 0xed, 0x68, 0xd, 0xb3, 0xbb, 0x4c, 0x40, 0x7a, 0x38, 0x96, 0x99, 0x97, 0xae, 0xb6, 0xa, 0x2c, 0x62, 0x39, 0x1, 0x6, 0x2f, 0x7f, 0x8e, 0xbf, 0x2f, 0xe7, 0x73, 0x3a, 0x61, 0x3c, 0xf1, 0x6b, 0x78, 0xf6, 0x10, 0xc6, 0x52, 0x32, 0xa2, 0x3c, 0xc5, 0xce, 0x25, 0xda, 0x29, 0xa3, 0xd5, 0x84, 0x85, 0xd8, 0x7b, 0xd8, 0x3d, 0xb8, 0x18, 0x3f, 0x8}}, Era: ExtrinsicEra{IsImmortalEra: true, IsMortalEra: false, AsMortalEra: MortalEra{First: 0x0, Second: 0x0}}, Nonce: 0x1, Tip: 0x2}, Method: Call{CallIndex: CallIndex{SectionIndex: 0x3, MethodIndex: 0x0}, Args: Args{0xff, 0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48, 0xe5, 0x6c}}} //nolint:lll
var ExamplaryExtrinsic = Extrinsic{Version: 0x84, Signature: ExtrinsicSignatureV5{Signer: AccountID{0xd4, 0x35, 0x93, 0xc7, 0x15, 0xfd, 0xd3, 0x1c, 0x61, 0x14, 0x1a, 0xbd, 0x4, 0xa9, 0x9f, 0xd6, 0x82, 0x2c, 0x85, 0x58, 0x85, 0x4c, 0xcd, 0xe3, 0x9a, 0x56, 0x84, 0xe7, 0xa5, 0x6d, 0xa2, 0x7d}, Signature: MultiSignature{IsSr25519: true, AsSr25519: Signature{0x5c, 0x77, 0x1d, 0xd5, 0x6a, 0xe0, 0xce, 0xed, 0x68, 0xd, 0xb3, 0xbb, 0x4c, 0x40, 0x7a, 0x38, 0x96, 0x99, 0x97, 0xae, 0xb6, 0xa, 0x2c, 0x62, 0x39, 0x1, 0x6, 0x2f, 0x7f, 0x8e, 0xbf, 0x2f, 0xe7, 0x73, 0x3a, 0x61, 0x3c, 0xf1, 0x6b, 0x78, 0xf6, 0x10, 0xc6, 0x52, 0x32, 0xa2, 0x3c, 0xc5, 0xce, 0x25, 0xda, 0x29, 0xa3, 0xd5, 0x84, 0x85, 0xd8, 0x7b, 0xd8, 0x3d, 0xb8, 0x18, 0x3f, 0x8}}, Era: ExtrinsicEra{IsImmortalEra: true, IsMortalEra: false, AsMortalEra: MortalEra{First: 0x0, Second: 0x0}}, Nonce: 0x1, Tip: 0x2}, Method: Call{CallIndex: CallIndex{SectionIndex: 0x3, MethodIndex: 0x0}, Args: Args{0xff, 0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48, 0xe5, 0x6c}}} //nolint:lll
2 changes: 1 addition & 1 deletion types/extrinsic_payload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func TestExtrinsicPayload_Sign(t *testing.T) {
// verify sig
b, err := EncodeToBytes(examplaryExtrinsicPayload)
assert.NoError(t, err)
ok, err := signature.Verify(b, sig[:], signature.TestKeyringPairAlice.URI)
ok, err := signature.Verify(b, sig[:], signature.TestKeyringPairAlice.Address)
assert.NoError(t, err)
assert.True(t, ok)
}
8 changes: 8 additions & 0 deletions types/extrinsic_signature.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ type ExtrinsicSignatureV4 struct {
Tip UCompact // extra via balances::TakeFees (Compact<Balance> where Balance is u128))
}

type ExtrinsicSignatureV5 struct {
Signer AccountID
Signature MultiSignature
Era ExtrinsicEra // extra via system::CheckEra
Nonce UCompact // extra via system::CheckNonce (Compact<Index> where Index is u32))
Tip UCompact // extra via balances::TakeFees (Compact<Balance> where Balance is u128))
}

type SignatureOptions struct {
Era ExtrinsicEra // extra via system::CheckEra
Nonce UCompact // extra via system::CheckNonce (Compact<Index> where Index is u32)
Expand Down
5 changes: 3 additions & 2 deletions types/extrinsic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,9 @@ func TestExtrinsic_Sign(t *testing.T) {
err = DecodeFromHexString(extEnc, &extDec)
assert.NoError(t, err)

accID := NewAccountID(signature.TestKeyringPairAlice.PublicKey)
assert.Equal(t, uint8(ExtrinsicVersion4), extDec.Type())
assert.Equal(t, signature.TestKeyringPairAlice.PublicKey, extDec.Signature.Signer.AsAccountID[:])
assert.Equal(t, accID, extDec.Signature.Signer)

mb, err := EncodeToBytes(extDec.Method)
assert.NoError(t, err)
Expand All @@ -132,7 +133,7 @@ func TestExtrinsic_Sign(t *testing.T) {
// verify sig
b, err := EncodeToBytes(verifyPayload)
assert.NoError(t, err)
ok, err := signature.Verify(b, extDec.Signature.Signature.AsSr25519[:], signature.TestKeyringPairAlice.URI)
ok, err := signature.Verify(b, extDec.Signature.Signature.AsSr25519[:], signature.TestKeyringPairAlice.Address)
assert.NoError(t, err)
assert.True(t, ok)
}
Expand Down

0 comments on commit 461cf42

Please sign in to comment.