core: add MinimumDeploymentFee
This commit is contained in:
parent
a65544aab1
commit
d34353aec2
5 changed files with 101 additions and 41 deletions
|
@ -89,42 +89,42 @@ func TestContractDeploy(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
t.Run("no NEF", func(t *testing.T) {
|
||||
res, err := invokeContractMethod(bc, 10_00000000, mgmtHash, "deploy", nil, manif1)
|
||||
res, err := invokeContractMethod(bc, 11_00000000, mgmtHash, "deploy", nil, manif1)
|
||||
require.NoError(t, err)
|
||||
checkFAULTState(t, res)
|
||||
})
|
||||
t.Run("no manifest", func(t *testing.T) {
|
||||
res, err := invokeContractMethod(bc, 10_00000000, mgmtHash, "deploy", nef1b, nil)
|
||||
res, err := invokeContractMethod(bc, 11_00000000, mgmtHash, "deploy", nef1b, nil)
|
||||
require.NoError(t, err)
|
||||
checkFAULTState(t, res)
|
||||
})
|
||||
t.Run("int for NEF", func(t *testing.T) {
|
||||
res, err := invokeContractMethod(bc, 10_00000000, mgmtHash, "deploy", int64(1), manif1)
|
||||
res, err := invokeContractMethod(bc, 11_00000000, mgmtHash, "deploy", int64(1), manif1)
|
||||
require.NoError(t, err)
|
||||
checkFAULTState(t, res)
|
||||
})
|
||||
t.Run("zero-length NEF", func(t *testing.T) {
|
||||
res, err := invokeContractMethod(bc, 10_00000000, mgmtHash, "deploy", []byte{}, manif1)
|
||||
res, err := invokeContractMethod(bc, 11_00000000, mgmtHash, "deploy", []byte{}, manif1)
|
||||
require.NoError(t, err)
|
||||
checkFAULTState(t, res)
|
||||
})
|
||||
t.Run("array for NEF", func(t *testing.T) {
|
||||
res, err := invokeContractMethod(bc, 10_00000000, mgmtHash, "deploy", []interface{}{int64(1)}, manif1)
|
||||
res, err := invokeContractMethod(bc, 11_00000000, mgmtHash, "deploy", []interface{}{int64(1)}, manif1)
|
||||
require.NoError(t, err)
|
||||
checkFAULTState(t, res)
|
||||
})
|
||||
t.Run("int for manifest", func(t *testing.T) {
|
||||
res, err := invokeContractMethod(bc, 10_00000000, mgmtHash, "deploy", nef1b, int64(1))
|
||||
res, err := invokeContractMethod(bc, 11_00000000, mgmtHash, "deploy", nef1b, int64(1))
|
||||
require.NoError(t, err)
|
||||
checkFAULTState(t, res)
|
||||
})
|
||||
t.Run("zero-length manifest", func(t *testing.T) {
|
||||
res, err := invokeContractMethod(bc, 10_00000000, mgmtHash, "deploy", nef1b, []byte{})
|
||||
res, err := invokeContractMethod(bc, 11_00000000, mgmtHash, "deploy", nef1b, []byte{})
|
||||
require.NoError(t, err)
|
||||
checkFAULTState(t, res)
|
||||
})
|
||||
t.Run("array for manifest", func(t *testing.T) {
|
||||
res, err := invokeContractMethod(bc, 10_00000000, mgmtHash, "deploy", nef1b, []interface{}{int64(1)})
|
||||
res, err := invokeContractMethod(bc, 11_00000000, mgmtHash, "deploy", nef1b, []interface{}{int64(1)})
|
||||
require.NoError(t, err)
|
||||
checkFAULTState(t, res)
|
||||
})
|
||||
|
@ -137,7 +137,7 @@ func TestContractDeploy(t *testing.T) {
|
|||
manifB, err := json.Marshal(badManifest)
|
||||
require.NoError(t, err)
|
||||
|
||||
res, err := invokeContractMethod(bc, 10_00000000, mgmtHash, "deploy", nef1b, manifB)
|
||||
res, err := invokeContractMethod(bc, 11_00000000, mgmtHash, "deploy", nef1b, manifB)
|
||||
require.NoError(t, err)
|
||||
checkFAULTState(t, res)
|
||||
})
|
||||
|
@ -147,7 +147,7 @@ func TestContractDeploy(t *testing.T) {
|
|||
checkFAULTState(t, res)
|
||||
})
|
||||
t.Run("positive", func(t *testing.T) {
|
||||
tx1, err := prepareContractMethodInvoke(bc, 10_00000000, mgmtHash, "deploy", nef1b, manif1)
|
||||
tx1, err := prepareContractMethodInvoke(bc, 11_00000000, mgmtHash, "deploy", nef1b, manif1)
|
||||
require.NoError(t, err)
|
||||
tx2, err := prepareContractMethodInvoke(bc, 1_00000000, mgmtHash, "getContract", cs1.Hash.BytesBE())
|
||||
require.NoError(t, err)
|
||||
|
@ -184,7 +184,7 @@ func TestContractDeploy(t *testing.T) {
|
|||
})
|
||||
})
|
||||
t.Run("contract already exists", func(t *testing.T) {
|
||||
res, err := invokeContractMethod(bc, 10_00000000, mgmtHash, "deploy", nef1b, manif1)
|
||||
res, err := invokeContractMethod(bc, 11_00000000, mgmtHash, "deploy", nef1b, manif1)
|
||||
require.NoError(t, err)
|
||||
checkFAULTState(t, res)
|
||||
})
|
||||
|
@ -207,7 +207,7 @@ func TestContractDeploy(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
manifD, err := json.Marshal(m)
|
||||
require.NoError(t, err)
|
||||
res, err := invokeContractMethod(bc, 10_00000000, mgmtHash, "deploy", nefDb, manifD)
|
||||
res, err := invokeContractMethod(bc, 11_00000000, mgmtHash, "deploy", nefDb, manifD)
|
||||
require.NoError(t, err)
|
||||
checkFAULTState(t, res)
|
||||
|
||||
|
@ -236,7 +236,7 @@ func TestContractDeploy(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
manifD, err := json.Marshal(m)
|
||||
require.NoError(t, err)
|
||||
res, err := invokeContractMethod(bc, 10_00000000, mgmtHash, "deploy", nefDb, manifD)
|
||||
res, err := invokeContractMethod(bc, 11_00000000, mgmtHash, "deploy", nefDb, manifD)
|
||||
require.NoError(t, err)
|
||||
checkFAULTState(t, res)
|
||||
|
||||
|
@ -455,3 +455,15 @@ func compareContractStates(t *testing.T, expected *state.Contract, actual stacki
|
|||
require.Equal(t, expected.Script, act[3].Value().([]byte))
|
||||
require.Equal(t, expectedManifest, act[4].Value().([]byte))
|
||||
}
|
||||
|
||||
func TestMinimumDeploymentFee(t *testing.T) {
|
||||
chain := newTestChain(t)
|
||||
defer chain.Close()
|
||||
|
||||
t.Run("get, internal method", func(t *testing.T) {
|
||||
n := chain.contracts.Management.GetMinimumDeploymentFee(chain.dao)
|
||||
require.Equal(t, 10_00000000, int(n))
|
||||
})
|
||||
|
||||
testGetSet(t, chain, chain.contracts.Management.Hash, "MinimumDeploymentFee", 10_00000000, 0, 0)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue