github.com/aergoio/aergo@v1.3.1/contract/enterprise/execute_test.go (about) 1 package enterprise 2 3 import ( 4 "encoding/pem" 5 "strings" 6 "testing" 7 8 "github.com/aergoio/aergo/state" 9 10 "github.com/aergoio/aergo/consensus" 11 "github.com/aergoio/aergo/types" 12 "github.com/stretchr/testify/assert" 13 ) 14 15 type MockCCC struct { 16 consensus.ChainConsensusCluster 17 } 18 19 func (ccc *MockCCC) MakeConfChangeProposal(req *types.MembershipChange) (*consensus.ConfChangePropose, error) { 20 return &consensus.ConfChangePropose{}, nil 21 } 22 23 var ( 24 ccc = &MockCCC{} 25 ) 26 27 func TestBasicFailEnterprise(t *testing.T) { 28 scs, sender, receiver := initTest(t) 29 defer deinitTest() 30 31 tx := &types.TxBody{} 32 testBlockNo := types.BlockNo(1) 33 34 _, err := ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 35 assert.Error(t, err, "empty body") 36 tx.Payload = []byte("invalid") 37 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 38 assert.Error(t, err, "invalid body") 39 tx.Payload = []byte("{}") 40 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 41 assert.Error(t, err, "empty json") 42 tx.Payload = []byte(`{"name":"enableConf"}`) 43 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 44 assert.Error(t, err, "empty arg in enable conf") 45 tx.Payload = []byte(`{"name":"setConf"}`) 46 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 47 assert.Error(t, err, "empty arg in set conf") 48 tx.Payload = []byte(`{"name":"enableConf", "args":["raft",true]}`) 49 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 50 assert.Error(t, err, "admin is not set when enble conf") 51 tx.Payload = []byte(`{"name":"setConf", "args":["raft","thisisraftid1", "thisisraftid2"]}`) 52 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 53 assert.Error(t, err, "admin is not set when set conf") 54 tx.Payload = []byte(`{"name":"setAdmin", "args":["AmPNYHyzyh9zweLwDyuoiUuTVCdrdksxkRWDjVJS76WQLExa2Jr"]}`) 55 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 56 assert.Error(t, err, "invalid arg in set admin") 57 tx.Payload = []byte(`{"name":"setAdmin", "args":[]}`) 58 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 59 assert.Error(t, err, "invalid arg in set admin") 60 61 tx.Payload = []byte(`{"name":"appendAdmin", "args":["AmPNYHyzyh9zweLwDyuoiUuTVCdrdksxkRWDjVJS76WQLExa2Jr4"]}`) 62 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 63 assert.NoError(t, err, "set admin") 64 tx.Payload = []byte(`{"name":"appendAdmin", "args":["AmLqZFnwMLqLg5fMshgzmfvwBP8uiYGgfV3tBZAm36Tv7jFYcs4f"]}`) 65 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 66 assert.NoError(t, err, "set admin") 67 tx.Payload = []byte(`{"name":"appendAdmin", "args":["AmLqZFnwMLqLg5fMshgzmfvwBP8uiYGgfV3tBZAm36Tv7jFYcs4f"]}`) 68 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 69 assert.Error(t, err, "set same admin permission") 70 71 tx.Payload = []byte(`{"name":"appendConf", "args":["admins", "AmLqZFnwMLqLg5fMshgzmfvwBP8uiYGgfV3tBZAm36Tv7jFYcs4f"]}`) 72 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 73 assert.Error(t, err, "not allowed key") 74 75 tx.Payload = []byte(`{"name":"appendConf", "args":["rpcpermissions", "AmLqZ\FnwMLqLg5fMshgzmfvwBP8uiYGgfV3tBZAm36Tv7jFYcs4f"]}`) 76 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 77 assert.Error(t, err, "not allowed char") 78 79 tx.Payload = []byte(`{"name":"setConf", "args":["p2pwhite","{\"peerid\":\"16Uiu2HAmAokYAtLbZxJAPRgp2jCc4bD35cJD921trqUANh59Rc4n\"}", "{\"peerid\":\"16Uiu2HAmAokYAtLbZxJAPRgp2jCc4bD35cJD921trqUANh59Rc4n\"}", "{\"peerid\":\"16Uiu2HAmGiJ2QgVAWHMUtzLKKNM5eFUJ3Ds3FN7nYJq1mHN5ZPj9\"}"]}`) 80 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 81 assert.Error(t, err, "duplicate arguments") 82 83 tx.Payload = []byte(`{"name":"setConf", "args":["p2pwhite","{\"peerid\":\"16Uiu2HAmAokYAtLbZxJAPRgp2jCc4bD35cJD921trqUANh59Rc4n\"}", "{\"peerid\":\"16Uiu2HAm4xYtGsqk7WGKUxr8prfVpJ25hD23AQ3Be6anEL9Kxkgw\"}", "{\"peerid\":\"16Uiu2HAmGiJ2QgVAWHMUtzLKKNM5eFUJ3Ds3FN7nYJq1mHN5ZPj9\"}"]}`) 84 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 85 assert.NoError(t, err, "set conf") 86 87 tx.Payload = []byte(`{"name":"appendConf", "args":["p2pwhite","16Uiu2HAmAokYAtLbZxJAPRgp2jCc4bD35cJD921trqUANh59Rc4n"]}`) 88 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 89 assert.Error(t, err, "duplicated set conf") 90 91 tx.Payload = []byte(`{"name":"setConf", "args":["rpcpermissions","dGVzdAo=:R", "dGVzdDIK:S", "dGVzdDMK:C"]}`) 92 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 93 assert.NoError(t, err, "set conf") 94 95 tx.Payload = []byte(`{"name":"enableConf", "args":["rpcpermissions",true]}`) 96 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 97 assert.Error(t, err, "enable conf") 98 99 tx.Payload = []byte(`{"name":"appendConf", "args":["rpcpermissions","dGVzdAo=:WR"]}`) 100 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 101 assert.NoError(t, err, "append conf") 102 103 tx.Payload = []byte(`{"name":"enableConf", "args":["rpcpermissions",true]}`) 104 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 105 assert.NoError(t, err, "enable conf") 106 107 tx.Payload = []byte(`{"name":"removeConf", "args":["rpcpermissions","dGVzdAo=:WR"]}`) 108 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 109 assert.Error(t, err, "remove conf") 110 } 111 112 func TestBasicEnterprise(t *testing.T) { 113 scs, sender, receiver := initTest(t) 114 defer deinitTest() 115 116 tx := &types.TxBody{} 117 testBlockNo := types.BlockNo(1) 118 119 tx.Payload = []byte(`{"name":"appendAdmin", "args":["AmPNYHyzyh9zweLwDyuoiUuTVCdrdksxkRWDjVJS76WQLExa2Jr4"]}`) 120 event, err := ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 121 assert.NoError(t, err, "add admin") 122 assert.Equal(t, "Append ADMIN", event[0].EventName, "append admin event") 123 assert.Equal(t, "\"AmPNYHyzyh9zweLwDyuoiUuTVCdrdksxkRWDjVJS76WQLExa2Jr4\"", event[0].JsonArgs, "append admin event") 124 tx.Payload = []byte(`{"name":"appendAdmin", "args":["AmLt7Z3y2XTu7YS8KHNuyKM2QAszpFHSX77FLKEt7FAuRW7GEhj7"]}`) 125 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 126 assert.NoError(t, err, "add admin") 127 admins, err := getAdmins(scs) 128 assert.NoError(t, err, "get after appending admin") 129 assert.Equal(t, 2, len(admins), "check admin") 130 assert.Equal(t, "AmPNYHyzyh9zweLwDyuoiUuTVCdrdksxkRWDjVJS76WQLExa2Jr4", types.EncodeAddress(admins[0]), "check admin") 131 assert.Equal(t, "AmLt7Z3y2XTu7YS8KHNuyKM2QAszpFHSX77FLKEt7FAuRW7GEhj7", types.EncodeAddress(admins[1]), "check admin") 132 133 tx.Payload = []byte(`{"name":"removeAdmin", "args":["AmLt7Z3y2XTu7YS8KHNuyKM2QAszpFHSX77FLKEt7FAuRW7GEhj7"]}`) 134 event, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 135 assert.NoError(t, err, "remove admin") 136 assert.Equal(t, "Remove ADMIN", event[0].EventName, "append admin event") 137 assert.Equal(t, "\"AmLt7Z3y2XTu7YS8KHNuyKM2QAszpFHSX77FLKEt7FAuRW7GEhj7\"", event[0].JsonArgs, "append admin event") 138 admins, err = getAdmins(scs) 139 assert.NoError(t, err, "get after removing admin") 140 assert.Equal(t, 1, len(admins), "check admin") 141 assert.Equal(t, "AmPNYHyzyh9zweLwDyuoiUuTVCdrdksxkRWDjVJS76WQLExa2Jr4", types.EncodeAddress(admins[0]), "check admin") 142 143 tx.Payload = []byte(`{"name":"setConf", "args":["p2pwhite","{\"peerid\":\"16Uiu2HAmAokYAtLbZxJAPRgp2jCc4bD35cJD921trqUANh59Rc4n\"}", "{\"peerid\":\"16Uiu2HAm4xYtGsqk7WGKUxr8prfVpJ25hD23AQ3Be6anEL9Kxkgw\"}", "{\"peerid\":\"16Uiu2HAmGiJ2QgVAWHMUtzLKKNM5eFUJ3Ds3FN7nYJq1mHN5ZPj9\"}"]}`) 144 event, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 145 assert.NoError(t, err, "set conf") 146 assert.Equal(t, "Set P2PWHITE", event[0].EventName, "append admin event") 147 conf, err := getConf(scs, []byte("P2PWhite")) //key is ignore case 148 assert.Equal(t, false, conf.On, "conf on") 149 assert.Equal(t, 3, len(conf.Values), "conf values length") 150 assert.Equal(t, `{"peerid":"16Uiu2HAmAokYAtLbZxJAPRgp2jCc4bD35cJD921trqUANh59Rc4n"}`, conf.Values[0], "conf value 0") 151 assert.Equal(t, `{"peerid":"16Uiu2HAm4xYtGsqk7WGKUxr8prfVpJ25hD23AQ3Be6anEL9Kxkgw"}`, conf.Values[1], "conf value 1") 152 assert.Equal(t, `{"peerid":"16Uiu2HAmGiJ2QgVAWHMUtzLKKNM5eFUJ3Ds3FN7nYJq1mHN5ZPj9"}`, conf.Values[2], "conf value 2") 153 154 tx.Payload = []byte(`{"name":"appendConf", "args":["p2pwhite","{\"peerid\":\"16Uiu2HAmAAtqye6QQbeG9EZnrWJbGK8Xw74cZxpnGGEAZAB3zJ8B\"}"]}`) 155 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 156 assert.NoError(t, err, "set conf") 157 assert.Equal(t, "Set P2PWHITE", event[0].EventName, "append admin event") 158 conf, err = getConf(scs, []byte("p2pwhite")) 159 assert.Equal(t, false, conf.On, "conf on") 160 assert.Equal(t, 4, len(conf.Values), "conf values length") 161 assert.Equal(t, `{"peerid":"16Uiu2HAmAAtqye6QQbeG9EZnrWJbGK8Xw74cZxpnGGEAZAB3zJ8B"}`, conf.Values[3], "conf value 3") 162 163 tx.Payload = []byte(`{"name":"enableConf", "args":["p2pwhite",true]}`) 164 event, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 165 //t.Log(event) 166 assert.NoError(t, err, "enable conf") 167 conf, err = getConf(scs, []byte("p2pwhite")) 168 assert.Equal(t, true, conf.On, "conf on") 169 170 block, _ := pem.Decode([]byte(testCert)) 171 assert.NotNil(t, block, "parse value 0") 172 cert := types.EncodeB64(block.Bytes) 173 tx.Payload = []byte(`{"name":"appendConf", "args":["rpcpermissions","` + cert + `:RWCS"]}`) 174 event, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 175 assert.NoError(t, err, "add conf") 176 conf, err = getConf(scs, []byte("rpcpermissions")) 177 assert.Equal(t, false, conf.On, "conf on") 178 assert.Equal(t, 1, len(conf.Values), "conf values length") 179 assert.Equal(t, cert, strings.Split(conf.Values[0], ":")[0], "conf value 0") 180 assert.Equal(t, "RWCS", strings.Split(conf.Values[0], ":")[1], "conf value 1") 181 182 tx.Payload = []byte(`{"name":"appendConf", "args":["rpcpermissions","` + strings.Split(conf.Values[0], ":")[0] + `:RWCS"]}`) 183 event, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 184 assert.Error(t, err, "dup add conf") 185 t.Log(event) 186 187 tx.Payload = []byte(`{"name":"enableConf", "args":["p2pwhite",false]}`) 188 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 189 assert.NoError(t, err, "enable conf") 190 conf, err = getConf(scs, []byte("p2pwhite")) 191 assert.Equal(t, false, conf.On, "conf on") 192 } 193 194 func TestEnterpriseChangeCluster(t *testing.T) { 195 consensus.SetCurConsensus("raft") 196 197 scs, sender, receiver := initTest(t) 198 defer deinitTest() 199 200 tx := &types.TxBody{} 201 testBlockNo := types.BlockNo(1) 202 203 tx.Payload = []byte(`{"name":"appendAdmin", "args":["AmPNYHyzyh9zweLwDyuoiUuTVCdrdksxkRWDjVJS76WQLExa2Jr4"]}`) 204 _, err := ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 205 assert.NoError(t, err, "add admin") 206 207 bs := state.NewBlockState(&state.StateDB{}) 208 tx.Payload = []byte(`{"name":"changeCluster", "args":[{"command" : "add", "name": "aergonew", "address": "/ip4/127.0.0.1/tcp/11001", "peerid":"16Uiu2HAmAAtqye6QQbeG9EZnrWJbGK8Xw74cZxpnGGEAZAB3zJ8B"}]}`) 209 _, err = ExecuteEnterpriseTx(bs, ccc, scs, tx, sender, receiver, testBlockNo) 210 assert.NoError(t, err) 211 assert.NotNil(t, bs.CCProposal) 212 213 bs = state.NewBlockState(&state.StateDB{}) 214 tx.Payload = []byte(`{"name":"changeCluster", "args":[{"command" : "remove", "id": "1234"}]}`) 215 _, err = ExecuteEnterpriseTx(bs, ccc, scs, tx, sender, receiver, testBlockNo) 216 assert.NoError(t, err) 217 assert.NotNil(t, bs.CCProposal) 218 219 bs = state.NewBlockState(&state.StateDB{}) 220 tx.Payload = []byte(`{"name":"changeCluster", "args":[{"command" : "nocmd", "name": "aergonew", "address": "/ip4/127.0.0.1/tcp/11001", "PeerID":"16Uiu2HAmAAtqye6QQbeG9EZnrWJbGK8Xw74cZxpnGGEAZAB3zJ8B"}]}`) 221 _, err = ExecuteEnterpriseTx(bs, ccc, scs, tx, sender, receiver, testBlockNo) 222 assert.Error(t, err) 223 assert.Nil(t, bs.CCProposal) 224 225 bs = state.NewBlockState(&state.StateDB{}) 226 tx.Payload = []byte(`{"name":"changeCluster", "args":[{"command" : "add", "name": "aergonew", "address": "http://127.0.0.1:1001", "peerid":"16Uiu2HAmAAtqye6QQbeG9EZnrWJbGK8Xw74cZxpnGGEAZAB3zJ8B"}]}`) 227 _, err = ExecuteEnterpriseTx(bs, ccc, scs, tx, sender, receiver, testBlockNo) 228 assert.Error(t, err) 229 assert.Nil(t, bs.CCProposal) 230 } 231 232 func TestCheckArgs(t *testing.T) { 233 scs, sender, receiver := initTest(t) 234 defer deinitTest() 235 236 tx := &types.TxBody{} 237 testBlockNo := types.BlockNo(1) 238 239 tx.Payload = []byte(`{"name":"appendAdmin", "args":["AmPNYHyzyh9zweLwDyuoiUuTVCdrdksxkRWDjVJS76WQLExa2Jr4"]}`) 240 _, err := ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 241 assert.NoError(t, err, "add admin") 242 243 block, _ := pem.Decode([]byte(testCert)) 244 assert.NotNil(t, block, "parse value 0") 245 cert := types.EncodeB64(block.Bytes) 246 tx.Payload = []byte(`{"name":"appendConf", "args":["rpcpermissions","` + cert + `:RWCS"]}`) 247 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 248 assert.NoError(t, err, RPCPermissions) 249 250 //missing permission string 251 tx.Payload = []byte(`{"name":"appendConf", "args":["rpcpermissions","` + cert + `"]}`) 252 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 253 assert.Error(t, err, RPCPermissions) 254 255 //invalid rpc cert 256 tx.Payload = []byte(`{"name":"appendConf", "args":["rpcpermissions","-+TEST+-:RWCS"]}`) 257 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 258 assert.Error(t, err, RPCPermissions) 259 260 tx.Payload = []byte(`{"name":"appendConf", "args":["accountwhite","AmMMFgzR14wdQBTCCuyXQj3NYrBenecCmurutTqPqqBZ9TEY2z7c"]}`) 261 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 262 assert.NoError(t, err, AccountWhite) 263 264 //invalid account address 265 tx.Payload = []byte(`{"name":"appendConf", "args":["accountwhite","BmMMFgzR14wdQBTCCuyXQj3NYrBenecCmurutTqPqqBZ9TEY2z7c"]}`) 266 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 267 assert.Error(t, err, AccountWhite) 268 } 269 270 func TestEnterpriseAdminAccountWhitelist(t *testing.T) { 271 scs, sender, receiver := initTest(t) 272 defer deinitTest() 273 274 tx := &types.TxBody{} 275 testBlockNo := types.BlockNo(1) 276 277 tx.Payload = []byte(`{"name":"appendAdmin", "args":["AmPNYHyzyh9zweLwDyuoiUuTVCdrdksxkRWDjVJS76WQLExa2Jr4"]}`) 278 _, err := ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 279 assert.NoError(t, err, "add admin") 280 tx.Payload = []byte(`{"name":"appendAdmin", "args":["AmLt7Z3y2XTu7YS8KHNuyKM2QAszpFHSX77FLKEt7FAuRW7GEhj7"]}`) 281 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 282 assert.NoError(t, err, "add admin") 283 284 tx.Payload = []byte(`{"name":"appendConf", "args":["accountwhite","AmMMFgzR14wdQBTCCuyXQj3NYrBenecCmurutTqPqqBZ9TEY2z7c"]}`) 285 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 286 assert.NoError(t, err, AccountWhite) 287 288 tx.Payload = []byte(`{"name":"enableConf", "args":["accountwhite",true]}`) 289 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 290 assert.EqualError(t, err, "the values of ACCOUNTWHITE should have at least one admin address", AccountWhite) 291 292 tx.Payload = []byte(`{"name":"appendConf", "args":["accountwhite","AmLt7Z3y2XTu7YS8KHNuyKM2QAszpFHSX77FLKEt7FAuRW7GEhj7"]}`) 293 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 294 assert.NoError(t, err, AccountWhite) 295 296 tx.Payload = []byte(`{"name":"removeAdmin", "args":["AmLt7Z3y2XTu7YS8KHNuyKM2QAszpFHSX77FLKEt7FAuRW7GEhj7"]}`) 297 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 298 assert.NoError(t, err, "remove admin") 299 300 tx.Payload = []byte(`{"name":"enableConf", "args":["accountwhite",true]}`) 301 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 302 assert.EqualError(t, err, "the values of ACCOUNTWHITE should have at least one admin address", AccountWhite) 303 304 tx.Payload = []byte(`{"name":"appendAdmin", "args":["AmLt7Z3y2XTu7YS8KHNuyKM2QAszpFHSX77FLKEt7FAuRW7GEhj7"]}`) 305 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 306 assert.NoError(t, err, "add admin") 307 308 tx.Payload = []byte(`{"name":"enableConf", "args":["accountwhite",true]}`) 309 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 310 assert.NoError(t, err, AccountWhite) 311 312 tx.Payload = []byte(`{"name":"removeAdmin", "args":["AmLt7Z3y2XTu7YS8KHNuyKM2QAszpFHSX77FLKEt7FAuRW7GEhj7"]}`) 313 _, err = ExecuteEnterpriseTx(nil, ccc, scs, tx, sender, receiver, testBlockNo) 314 assert.EqualError(t, err, "admin is in the account whitelist: AmLt7Z3y2XTu7YS8KHNuyKM2QAszpFHSX77FLKEt7FAuRW7GEhj7", AccountWhite) 315 }