use WithValue language for test

This commit is contained in:
Mike Seiler 2023-02-06 20:35:35 +00:00
parent f671a3c81c
commit 2673ec3c82
2 changed files with 9 additions and 9 deletions

View File

@ -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{})

View File

@ -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) {