From 2673ec3c820a7dd14e4defcf8b4276e0a824e241 Mon Sep 17 00:00:00 2001 From: Mike Seiler Date: Mon, 6 Feb 2023 20:35:35 +0000 Subject: [PATCH] use WithValue language for test --- itests/fevm_test.go | 4 ++-- itests/kit/evm.go | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/itests/fevm_test.go b/itests/fevm_test.go index 779400b5d..055c1c275 100644 --- a/itests/fevm_test.go +++ b/itests/fevm_test.go @@ -704,7 +704,7 @@ func TestFEVMRecursiveActorCallEstimate(t *testing.T) { } // TestFEVM deploys a contract while sending value to it -func TestFEVMDeployValue(t *testing.T) { +func TestFEVMDeployWithValue(t *testing.T) { ctx, cancel, client := kit.SetupFEVMTest(t) defer cancel() @@ -716,7 +716,7 @@ func TestFEVMDeployValue(t *testing.T) { // testValue is sent to DeployValueTest and that amount is // also sent to NewContract filenameActor := "contracts/DeployValueTest.hex" - fromAddr, idAddr := client.EVM().DeployContractFromFilenameValue(ctx, filenameActor, testValue) + fromAddr, idAddr := client.EVM().DeployContractFromFilenameWithValue(ctx, filenameActor, testValue) //call getNewContractBalance to find the value of NewContract ret, _, err := client.EVM().InvokeContractByFuncName(ctx, fromAddr, idAddr, "getNewContractBalance()", []byte{}) diff --git a/itests/kit/evm.go b/itests/kit/evm.go index 6f14ad74c..6f327f108 100644 --- a/itests/kit/evm.go +++ b/itests/kit/evm.go @@ -42,13 +42,13 @@ func (f *TestFullNode) EVM() *EVM { return &EVM{f} } -func (e *EVM) DeployContractValue(ctx context.Context, sender address.Address, bytecode []byte, value big.Int) eam.CreateReturn { +func (e *EVM) DeployContractWithValue(ctx context.Context, sender address.Address, bytecode []byte, value big.Int) eam.CreateReturn { require := require.New(e.t) method := builtintypes.MethodsEAM.CreateExternal initcode := abi.CborBytes(bytecode) - params, err := actors.SerializeParams(&initcode) - require.NoError(err) + params, errActors := actors.SerializeParams(&initcode) + require.NoError(errActors) msg := &types.Message{ To: builtintypes.EthereumAddressManagerActorAddr, @@ -76,10 +76,10 @@ func (e *EVM) DeployContractValue(ctx context.Context, sender address.Address, b return result } func (e *EVM) DeployContract(ctx context.Context, sender address.Address, bytecode []byte) eam.CreateReturn { - return e.DeployContractValue(ctx, sender, bytecode, big.Zero()) + return e.DeployContractWithValue(ctx, sender, bytecode, big.Zero()) } -func (e *EVM) DeployContractFromFilenameValue(ctx context.Context, binFilename string, value big.Int) (address.Address, address.Address) { +func (e *EVM) DeployContractFromFilenameWithValue(ctx context.Context, binFilename string, value big.Int) (address.Address, address.Address) { contractHex, err := os.ReadFile(binFilename) require.NoError(e.t, err) @@ -92,14 +92,14 @@ func (e *EVM) DeployContractFromFilenameValue(ctx context.Context, binFilename s fromAddr, err := e.WalletDefaultAddress(ctx) require.NoError(e.t, err) - result := e.DeployContractValue(ctx, fromAddr, contract, value) + result := e.DeployContractWithValue(ctx, fromAddr, contract, value) idAddr, err := address.NewIDAddress(result.ActorID) require.NoError(e.t, err) return fromAddr, idAddr } func (e *EVM) DeployContractFromFilename(ctx context.Context, binFilename string) (address.Address, address.Address) { - return e.DeployContractFromFilenameValue(ctx, binFilename, big.Zero()) + return e.DeployContractFromFilenameWithValue(ctx, binFilename, big.Zero()) } func (e *EVM) InvokeSolidity(ctx context.Context, sender address.Address, target address.Address, selector []byte, inputData []byte) (*api.MsgLookup, error) {