OSDN Git Service

V0.1 pk interface (#58)
[bytom/vapor.git] / protocol / vm / crypto_test.go
index b6bf9e6..6c14329 100644 (file)
@@ -85,9 +85,6 @@ func TestCheckSig(t *testing.T) {
 }
 
 func TestCryptoOps(t *testing.T) {
 }
 
 func TestCryptoOps(t *testing.T) {
-       OP_SM3 := Op(0xb0)
-       ops[OP_SM3] = opInfo{OP_SM3, "SM3", opSm3}
-
        type testStruct struct {
                op      Op
                startVM *virtualMachine
        type testStruct struct {
                op      Op
                startVM *virtualMachine
@@ -147,29 +144,27 @@ func TestCryptoOps(t *testing.T) {
                        }},
                },
        }, {
                        }},
                },
        }, {
-               op: OP_SM3,
+               op: OP_HASH160,
                startVM: &virtualMachine{
                        runLimit:  50000,
                        dataStack: [][]byte{{1}},
                },
                wantVM: &virtualMachine{
                startVM: &virtualMachine{
                        runLimit:  50000,
                        dataStack: [][]byte{{1}},
                },
                wantVM: &virtualMachine{
-                       runLimit: 49905,
+                       runLimit: 49916,
                        dataStack: [][]byte{{
                        dataStack: [][]byte{{
-                               121, 155, 113, 154, 192, 49, 252, 137, 198, 216, 146, 90, 72, 125, 173, 7,
-                               48, 143, 131, 123, 122, 183, 187, 199, 206, 189, 58, 65, 24, 253, 47, 56,
+                               242, 145, 186, 80, 21, 223, 52, 140, 128, 133, 63, 165, 187, 15, 121, 70, 245, 201, 225, 179,
                        }},
                },
        }, {
                        }},
                },
        }, {
-               op: OP_SM3,
+               op: OP_HASH160,
                startVM: &virtualMachine{
                        runLimit:  50000,
                        dataStack: [][]byte{make([]byte, 65)},
                },
                wantVM: &virtualMachine{
                startVM: &virtualMachine{
                        runLimit:  50000,
                        dataStack: [][]byte{make([]byte, 65)},
                },
                wantVM: &virtualMachine{
-                       runLimit: 49968,
+                       runLimit: 49916,
                        dataStack: [][]byte{{
                        dataStack: [][]byte{{
-                               177, 247, 110, 45, 29, 65, 214, 241, 187, 59, 9, 192, 155, 130, 25, 218,
-                               251, 173, 112, 13, 242, 72, 34, 32, 200, 146, 190, 65, 68, 90, 34, 255,
+                               171, 60, 102, 205, 10, 63, 18, 180, 244, 250, 235, 84, 138, 85, 22, 7, 148, 250, 215, 6,
                        }},
                },
        }, {
                        }},
                },
        }, {
@@ -426,7 +421,7 @@ func TestCryptoOps(t *testing.T) {
                wantErr: ErrRunLimitExceeded,
        }}
 
                wantErr: ErrRunLimitExceeded,
        }}
 
-       hashOps := []Op{OP_SHA256, OP_SHA3, OP_SM3}
+       hashOps := []Op{OP_SHA256, OP_SHA3}
        for _, op := range hashOps {
                cases = append(cases, testStruct{
                        op: op,
        for _, op := range hashOps {
                cases = append(cases, testStruct{
                        op: op,