MCPcopy Create free account
hub / github.com/33cn/chain33 / TestKeyAllow

Function TestKeyAllow

executor/executor_test.go:115–137  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

113}
114
115func TestKeyAllow(t *testing.T) {
116 exect, _ := initEnv(types.GetDefaultCfgstring())
117 execInit(nil)
118 key := []byte("mavl-coins-bty-exec-1wvmD6RNHzwhY4eN75WnM6JcaAvNQ4nHx:19xXg1WHzti5hzBRTUphkM8YmuX6jJkoAA")
119 exec := []byte("retrieve")
120 tx1 := "0a05636f696e73120e18010a0a1080c2d72f1a036f746520a08d0630f1cdebc8f7efa5e9283a22313271796f6361794e46374c7636433971573461767873324537553431664b536676"
121 tx11, _ := hex.DecodeString(tx1)
122 var tx12 types.Transaction
123 types.Decode(tx11, &tx12)
124 tx12.Execer = exec
125 ctx := &executorCtx{
126 stateHash: nil,
127 height: 1,
128 blocktime: time.Now().Unix(),
129 difficulty: 1,
130 mainHash: nil,
131 parentHash: nil,
132 }
133 execute := newExecutor(ctx, exect, nil, nil, nil)
134 if !isAllowKeyWrite(execute, key, exec, &tx12, 0) {
135 t.Error("retrieve can modify exec")
136 }
137}
138
139func TestKeyAllow_evm(t *testing.T) {
140 exect, _ := initEnv(types.GetDefaultCfgstring())

Callers

nothing calls this directly

Calls 8

GetDefaultCfgstringFunction · 0.92
DecodeFunction · 0.92
execInitFunction · 0.85
newExecutorFunction · 0.85
isAllowKeyWriteFunction · 0.85
DecodeStringMethod · 0.80
initEnvFunction · 0.70
ErrorMethod · 0.65

Tested by

no test coverage detected