aboutsummaryrefslogtreecommitdiff
path: root/plugin/evm
diff options
context:
space:
mode:
authorAaron Buchwald <[email protected]>2020-10-07 12:03:53 -0400
committerAaron Buchwald <[email protected]>2020-10-07 12:03:53 -0400
commitb443cefe38e01d60be0566ec030e42c5f89e17e2 (patch)
tree18e0bc7eb502f4da132fbba2a73d29399a13beaa /plugin/evm
parenta5b80ffc01821becffbe4f36d937f778c911af5f (diff)
Fix export tx credential verification
Diffstat (limited to 'plugin/evm')
-rw-r--r--plugin/evm/export_tx.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/plugin/evm/export_tx.go b/plugin/evm/export_tx.go
index 067252a..89aa30e 100644
--- a/plugin/evm/export_tx.go
+++ b/plugin/evm/export_tx.go
@@ -92,12 +92,21 @@ func (tx *UnsignedExportTx) SemanticVerify(
return permError{err}
}
+ if len(tx.Ins) != len(stx.Creds) {
+ return permError{errSignatureInputsMismatch}
+ }
+
f := crypto.FactorySECP256K1R{}
- for i, cred := range stx.Creds {
+ for i, input := range tx.Ins {
+ cred := stx.Creds[i].(*secp256k1fx.Credential)
if err := cred.Verify(); err != nil {
return permError{err}
}
- pubKey, err := f.RecoverPublicKey(tx.UnsignedBytes(), cred.(*secp256k1fx.Credential).Sigs[0][:])
+
+ if len(cred.Sigs) != 1 {
+ return permError{fmt.Errorf("expected one signature for EVM Input Credential, but found: %d", len(secpCredential.Sigs))}
+ }
+ pubKey, err := f.RecoverPublicKey(tx.UnsignedBytes(), secpCredential.Sigs[0][:])
if err != nil {
return permError{err}
}