Skip to content

Commit

Permalink
fix: gas should be 100000 for tests and contract deletion requires an…
Browse files Browse the repository at this point in the history
… obtainer

Signed-off-by: Daniel Akhterov <[email protected]>
  • Loading branch information
janaakhterov committed Mar 1, 2022
1 parent 84f10fe commit 4981e56
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 41 deletions.
18 changes: 12 additions & 6 deletions contract_bytecode_query_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestIntegrationContractBytecodeQueryCanExecute(t *testing.T) {
contractResponse, err := NewContractCreateTransaction().
SetAdminKey(env.OperatorKey).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetGas(75000).
SetGas(100000).
SetConstructorParameters(NewContractFunctionParameters().AddString("Hello from Hedera.")).
SetBytecodeFileID(fileID).
SetContractMemo("[e2e::ContractCreateTransaction]").
Expand Down Expand Up @@ -60,6 +60,7 @@ func TestIntegrationContractBytecodeQueryCanExecute(t *testing.T) {

resp, err = NewContractDeleteTransaction().
SetContractID(contractID).
SetTransferAccountID(env.Client.GetOperatorAccountID()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
Execute(env.Client)
require.NoError(t, err)
Expand Down Expand Up @@ -101,7 +102,7 @@ func TestIntegrationContractBytecodeQueryGetCostExecute(t *testing.T) {
contractResponse, err := NewContractCreateTransaction().
SetAdminKey(env.OperatorKey).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetGas(75000).
SetGas(100000).
SetConstructorParameters(NewContractFunctionParameters().AddString("Hello from Hedera.")).
SetBytecodeFileID(fileID).
SetContractMemo("[e2e::ContractCreateTransaction]").
Expand Down Expand Up @@ -132,6 +133,7 @@ func TestIntegrationContractBytecodeQueryGetCostExecute(t *testing.T) {

resp, err = NewContractDeleteTransaction().
SetContractID(contractID).
SetTransferAccountID(env.Client.GetOperatorAccountID()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
Execute(env.Client)
require.NoError(t, err)
Expand Down Expand Up @@ -173,7 +175,7 @@ func TestIntegrationContractBytecodeQuerySetBigMaxPayment(t *testing.T) {
contractResponse, err := NewContractCreateTransaction().
SetAdminKey(env.OperatorKey).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetGas(75000).
SetGas(100000).
SetConstructorParameters(NewContractFunctionParameters().AddString("Hello from Hedera.")).
SetBytecodeFileID(fileID).
SetContractMemo("[e2e::ContractCreateTransaction]").
Expand Down Expand Up @@ -204,6 +206,7 @@ func TestIntegrationContractBytecodeQuerySetBigMaxPayment(t *testing.T) {

resp, err = NewContractDeleteTransaction().
SetContractID(contractID).
SetTransferAccountID(env.Client.GetOperatorAccountID()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
Execute(env.Client)
require.NoError(t, err)
Expand Down Expand Up @@ -245,7 +248,7 @@ func TestIntegrationContractBytecodeQuerySetSmallMaxPayment(t *testing.T) {
contractResponse, err := NewContractCreateTransaction().
SetAdminKey(env.OperatorKey).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetGas(75000).
SetGas(100000).
SetConstructorParameters(NewContractFunctionParameters().AddString("Hello from Hedera.")).
SetBytecodeFileID(fileID).
SetContractMemo("[e2e::ContractCreateTransaction]").
Expand Down Expand Up @@ -276,6 +279,7 @@ func TestIntegrationContractBytecodeQuerySetSmallMaxPayment(t *testing.T) {

resp, err = NewContractDeleteTransaction().
SetContractID(contractID).
SetTransferAccountID(env.Client.GetOperatorAccountID()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
Execute(env.Client)
require.NoError(t, err)
Expand Down Expand Up @@ -317,7 +321,7 @@ func TestIntegrationContractBytecodeQueryInsufficientFee(t *testing.T) {
contractResponse, err := NewContractCreateTransaction().
SetAdminKey(env.OperatorKey).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetGas(75000).
SetGas(100000).
SetConstructorParameters(NewContractFunctionParameters().AddString("Hello from Hedera.")).
SetBytecodeFileID(fileID).
SetContractMemo("[e2e::ContractCreateTransaction]").
Expand Down Expand Up @@ -348,6 +352,7 @@ func TestIntegrationContractBytecodeQueryInsufficientFee(t *testing.T) {

resp, err = NewContractDeleteTransaction().
SetContractID(contractID).
SetTransferAccountID(env.Client.GetOperatorAccountID()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
Execute(env.Client)
require.NoError(t, err)
Expand Down Expand Up @@ -389,7 +394,7 @@ func TestIntegrationContractBytecodeQueryNoContractID(t *testing.T) {
contractResponse, err := NewContractCreateTransaction().
SetAdminKey(env.OperatorKey).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetGas(75000).
SetGas(100000).
SetConstructorParameters(NewContractFunctionParameters().AddString("Hello from Hedera.")).
SetBytecodeFileID(fileID).
SetContractMemo("[e2e::ContractCreateTransaction]").
Expand Down Expand Up @@ -417,6 +422,7 @@ func TestIntegrationContractBytecodeQueryNoContractID(t *testing.T) {

resp, err = NewContractDeleteTransaction().
SetContractID(contractID).
SetTransferAccountID(env.Client.GetOperatorAccountID()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
Execute(env.Client)
require.NoError(t, err)
Expand Down
39 changes: 23 additions & 16 deletions contract_call_query_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestIntegrationContractCallQueryCanExecute(t *testing.T) {
resp, err = NewContractCreateTransaction().
SetAdminKey(env.OperatorKey.PublicKey()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetGas(75000).
SetGas(100000).
SetConstructorParameters(NewContractFunctionParameters().AddString("Hello from Hedera.")).
SetBytecodeFileID(fileID).
SetContractMemo("[e2e::ContractCreateTransaction]").
Expand All @@ -52,7 +52,7 @@ func TestIntegrationContractCallQueryCanExecute(t *testing.T) {
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetContractID(contractID).
SetQueryPayment(NewHbar(1)).
SetGas(75000).
SetGas(100000).
SetFunction("getMessage", nil).
SetMaxQueryPayment(NewHbar(5)).
Execute(env.Client)
Expand All @@ -63,7 +63,7 @@ func TestIntegrationContractCallQueryCanExecute(t *testing.T) {
resp, err = NewContractExecuteTransaction().
SetContractID(contractID).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetGas(75000).
SetGas(100000).
SetFunction("setMessage", NewContractFunctionParameters().AddString("new message")).
Execute(env.Client)
require.NoError(t, err)
Expand All @@ -76,7 +76,7 @@ func TestIntegrationContractCallQueryCanExecute(t *testing.T) {
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetMaxQueryPayment(NewHbar(2)).
SetQueryPayment(NewHbar(1)).
SetGas(75000).
SetGas(100000).
SetFunction("getMessage", nil).
Execute(env.Client)
require.NoError(t, err)
Expand All @@ -85,6 +85,7 @@ func TestIntegrationContractCallQueryCanExecute(t *testing.T) {

resp, err = NewContractDeleteTransaction().
SetContractID(contractID).
SetTransferAccountID(env.Client.GetOperatorAccountID()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
Execute(env.Client)
require.NoError(t, err)
Expand Down Expand Up @@ -126,7 +127,7 @@ func TestIntegrationContractCallQueryGetCost(t *testing.T) {
resp, err = NewContractCreateTransaction().
SetAdminKey(env.OperatorKey.PublicKey()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetGas(75000).
SetGas(100000).
SetConstructorParameters(NewContractFunctionParameters().AddString("Hello from Hedera.")).
SetBytecodeFileID(fileID).
SetContractMemo("[e2e::ContractCreateTransaction]").
Expand All @@ -146,7 +147,7 @@ func TestIntegrationContractCallQueryGetCost(t *testing.T) {
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetContractID(contractID).
SetMaxQueryPayment(NewHbar(1)).
SetGas(75000).
SetGas(100000).
SetFunction("getMessage", nil)

cost, err := callQuery.GetCost(env.Client)
Expand All @@ -157,6 +158,7 @@ func TestIntegrationContractCallQueryGetCost(t *testing.T) {

resp, err = NewContractDeleteTransaction().
SetContractID(contractID).
SetTransferAccountID(env.Client.GetOperatorAccountID()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
Execute(env.Client)
require.NoError(t, err)
Expand Down Expand Up @@ -198,7 +200,7 @@ func TestIntegrationContractCallQuerySetMaxPaymentBig(t *testing.T) {
resp, err = NewContractCreateTransaction().
SetAdminKey(env.OperatorKey.PublicKey()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetGas(75000).
SetGas(100000).
SetConstructorParameters(NewContractFunctionParameters().AddString("Hello from Hedera.")).
SetBytecodeFileID(fileID).
SetContractMemo("[e2e::ContractCreateTransaction]").
Expand All @@ -218,7 +220,7 @@ func TestIntegrationContractCallQuerySetMaxPaymentBig(t *testing.T) {
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetContractID(contractID).
SetMaxQueryPayment(NewHbar(10000)).
SetGas(75000).
SetGas(100000).
SetFunction("getMessage", nil)

_, err = callQuery.GetCost(env.Client)
Expand All @@ -229,6 +231,7 @@ func TestIntegrationContractCallQuerySetMaxPaymentBig(t *testing.T) {

resp, err = NewContractDeleteTransaction().
SetContractID(contractID).
SetTransferAccountID(env.Client.GetOperatorAccountID()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
Execute(env.Client)
require.NoError(t, err)
Expand Down Expand Up @@ -270,7 +273,7 @@ func TestIntegrationContractCallQuerySetSmallMaxPayment(t *testing.T) {
resp, err = NewContractCreateTransaction().
SetAdminKey(env.OperatorKey.PublicKey()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetGas(75000).
SetGas(100000).
SetConstructorParameters(NewContractFunctionParameters().AddString("Hello from Hedera.")).
SetBytecodeFileID(fileID).
SetContractMemo("[e2e::ContractCreateTransaction]").
Expand All @@ -290,7 +293,7 @@ func TestIntegrationContractCallQuerySetSmallMaxPayment(t *testing.T) {
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetContractID(contractID).
SetMaxQueryPayment(HbarFromTinybar(1)).
SetGas(75000).
SetGas(100000).
SetFunction("getMessage", nil)

cost, err := callQuery.GetCost(env.Client)
Expand All @@ -303,6 +306,7 @@ func TestIntegrationContractCallQuerySetSmallMaxPayment(t *testing.T) {

resp, err = NewContractDeleteTransaction().
SetContractID(contractID).
SetTransferAccountID(env.Client.GetOperatorAccountID()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
Execute(env.Client)
require.NoError(t, err)
Expand Down Expand Up @@ -344,7 +348,7 @@ func TestIntegrationContractCallQueryInsufficientFee(t *testing.T) {
resp, err = NewContractCreateTransaction().
SetAdminKey(env.Client.GetOperatorPublicKey()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetGas(75000).
SetGas(100000).
SetConstructorParameters(NewContractFunctionParameters().AddString("Hello from Hedera.")).
SetBytecodeFileID(fileID).
SetContractMemo("[e2e::ContractCreateTransaction]").
Expand All @@ -364,7 +368,7 @@ func TestIntegrationContractCallQueryInsufficientFee(t *testing.T) {
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetContractID(contractID).
SetMaxQueryPayment(NewHbar(1)).
SetGas(75000).
SetGas(100000).
SetFunction("getMessage", nil)

_, err = callQuery.GetCost(env.Client)
Expand All @@ -377,6 +381,7 @@ func TestIntegrationContractCallQueryInsufficientFee(t *testing.T) {

resp, err = NewContractDeleteTransaction().
SetContractID(contractID).
SetTransferAccountID(env.Client.GetOperatorAccountID()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
Execute(env.Client)
require.NoError(t, err)
Expand All @@ -401,7 +406,7 @@ func TestIntegrationContractCallQueryNoContractID(t *testing.T) {
env := NewIntegrationTestEnv(t)

_, err := NewContractCallQuery().
SetGas(75000).
SetGas(100000).
SetNodeAccountIDs(env.NodeAccountIDs).
// test getCost
SetFunction("getMessage", nil).
Expand Down Expand Up @@ -436,7 +441,7 @@ func TestIntegrationContractCallQueryNoGas(t *testing.T) {
resp, err = NewContractCreateTransaction().
SetAdminKey(env.OperatorKey.PublicKey()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetGas(75000).
SetGas(100000).
SetConstructorParameters(NewContractFunctionParameters().AddString("Hello from Hedera.")).
SetBytecodeFileID(fileID).
SetContractMemo("[e2e::ContractCreateTransaction]").
Expand Down Expand Up @@ -465,6 +470,7 @@ func TestIntegrationContractCallQueryNoGas(t *testing.T) {

resp, err = NewContractDeleteTransaction().
SetContractID(contractID).
SetTransferAccountID(env.Client.GetOperatorAccountID()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
Execute(env.Client)
require.NoError(t, err)
Expand Down Expand Up @@ -506,7 +512,7 @@ func TestIntegrationContractCallQueryNoFunction(t *testing.T) {
resp, err = NewContractCreateTransaction().
SetAdminKey(env.OperatorKey.PublicKey()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetGas(75000).
SetGas(100000).
SetConstructorParameters(NewContractFunctionParameters().AddString("Hello from Hedera.")).
SetBytecodeFileID(fileID).
SetContractMemo("[e2e::ContractCreateTransaction]").
Expand All @@ -525,7 +531,7 @@ func TestIntegrationContractCallQueryNoFunction(t *testing.T) {
_, err = NewContractCallQuery().
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetContractID(contractID).
SetGas(75000).
SetGas(100000).
SetQueryPayment(NewHbar(1)).
// test getCost
Execute(env.Client)
Expand All @@ -536,6 +542,7 @@ func TestIntegrationContractCallQueryNoFunction(t *testing.T) {

resp, err = NewContractDeleteTransaction().
SetContractID(contractID).
SetTransferAccountID(env.Client.GetOperatorAccountID()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
Execute(env.Client)
require.NoError(t, err)
Expand Down
4 changes: 3 additions & 1 deletion contract_create_transaction_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func TestIntegrationContractCreateTransactionCanExecute(t *testing.T) {

resp, err = NewContractDeleteTransaction().
SetContractID(contractID).
SetTransferAccountID(env.Client.GetOperatorAccountID()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
Execute(env.Client)
require.NoError(t, err)
Expand Down Expand Up @@ -116,6 +117,7 @@ func TestIntegrationContractCreateTransactionNoAdminKey(t *testing.T) {

resp, err = NewContractDeleteTransaction().
SetContractID(contractID).
SetTransferAccountID(env.Client.GetOperatorAccountID()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
Execute(env.Client)
require.NoError(t, err)
Expand Down Expand Up @@ -208,7 +210,7 @@ func TestIntegrationContractCreateTransactionNoBytecodeFileID(t *testing.T) {
resp, err = NewContractCreateTransaction().
SetAdminKey(env.Client.GetOperatorPublicKey()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetGas(75000).
SetGas(100000).
Execute(env.Client)
require.NoError(t, err)

Expand Down
5 changes: 3 additions & 2 deletions contract_delete_transaction_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestIntegrationContractDeleteTransactionCanExecute(t *testing.T) {

resp, err = NewContractCreateTransaction().
SetAdminKey(env.Client.GetOperatorPublicKey()).
SetGas(75000).
SetGas(100000).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetConstructorParameters(NewContractFunctionParameters().AddString("hello from hedera")).
SetBytecodeFileID(fileID).
Expand All @@ -51,6 +51,7 @@ func TestIntegrationContractDeleteTransactionCanExecute(t *testing.T) {

resp, err = NewContractDeleteTransaction().
SetContractID(contractID).
SetTransferAccountID(env.Client.GetOperatorAccountID()).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
Execute(env.Client)
require.NoError(t, err)
Expand Down Expand Up @@ -104,7 +105,7 @@ func TestIntegrationContractDeleteTransactionNoContractID(t *testing.T) {

resp, err = NewContractCreateTransaction().
SetAdminKey(env.Client.GetOperatorPublicKey()).
SetGas(75000).
SetGas(100000).
SetNodeAccountIDs([]AccountID{resp.NodeID}).
SetConstructorParameters(NewContractFunctionParameters().AddString("hello from hedera")).
SetBytecodeFileID(fileID).
Expand Down
Loading

0 comments on commit 4981e56

Please sign in to comment.