Add full V2 transaction verification pipeline: parse SignaturesRaw variant vector into structured ZC signature data, verify CLSAG GGX ring signatures per ZC input, verify BPP range proofs, and verify BGE asset surjection proofs with correct ring construction (mul8 point arithmetic). Fix three wire format bugs that caused V2 parsing failures: - RefTypeGlobalIndex (tag 0x1A) uses 8-byte LE, not varint - Raw uint64_t variant (tagUint64) uses 8-byte LE, not varint - zarcanum_tx_data_v1 fee uses FIELD() → 8-byte LE, not VARINT_FIELD() Add cn_point_sub to C++ bridge and Go wrapper for BGE ring construction. Add GetZCRingOutputs to chain for fetching ZC ring member data. Co-Authored-By: Charon <charon@lethean.io>
25 lines
666 B
Go
25 lines
666 B
Go
//go:build !integration
|
|
|
|
package consensus
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"forge.lthn.ai/core/go-blockchain/config"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestVerifyTransactionSignatures_Good_Coinbase(t *testing.T) {
|
|
// Coinbase transactions have no signatures to verify.
|
|
tx := validMinerTx(100)
|
|
err := VerifyTransactionSignatures(tx, config.MainnetForks, 100, nil, nil)
|
|
require.NoError(t, err)
|
|
}
|
|
|
|
func TestVerifyTransactionSignatures_Bad_MissingSigs(t *testing.T) {
|
|
tx := validV1Tx()
|
|
tx.Signatures = nil // no signatures
|
|
err := VerifyTransactionSignatures(tx, config.MainnetForks, 100, nil, nil)
|
|
assert.Error(t, err)
|
|
}
|