Skip to content

Commit

Permalink
fix imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
raulk committed Nov 15, 2022
1 parent 4a6667b commit fdf546b
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 2 deletions.
1 change: 1 addition & 0 deletions itests/contracts/events.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
63000000678063000000116000396000f360003560e01c80600014601f578060011460365780600214604157600080fd5b67112233445566778860005260086018a060006000f35b60006000a060006000f35b67112233445566778860005263000044446200333361222261111160086018a460006000f3
55 changes: 55 additions & 0 deletions itests/fevm_events_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package itests

import (
"context"
"fmt"
"os"
"regexp"
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/cli"
"github.com/filecoin-project/lotus/itests/kit"
)

// TestFEVMEvents does a basic events smoke test.
func TestFEVMEvents(t *testing.T) {
_ = os.Setenv("BELLMAN_NO_GPU", "1")
kit.QuietMiningLogs()

blockTime := 100 * time.Millisecond
client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC())
ens.InterconnectAll().BeginMining(blockTime)

ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()

// Create mock CLI
mockCLI := kit.NewMockCLI(ctx, t, cli.Commands, api.NodeFull)
clientCLI := mockCLI.Client(client.ListenAddr)

idAddrRx := regexp.MustCompile("ID Address: (.*)")
// Install contract
out := clientCLI.RunCmd("chain", "create-evm-actor", "--hex", "contracts/events.bin")
require.Regexp(t, idAddrRx, out)

// Extract robust address
idAddr := idAddrRx.FindStringSubmatch(out)[1]
require.NotEmpty(t, idAddr)

// Invoke contract with owner
out = clientCLI.RunCmd("chain", "invoke-evm-actor", idAddr, "00000000", "")
require.NotEmpty(t, out)
fmt.Println(out)

out = clientCLI.RunCmd("chain", "invoke-evm-actor", idAddr, "00000001", "")
require.NotEmpty(t, out)
fmt.Println(out)

out = clientCLI.RunCmd("chain", "invoke-evm-actor", idAddr, "00000002", "")
require.NotEmpty(t, out)
fmt.Println(out)
}
1 change: 1 addition & 0 deletions itests/fevm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
cbg "github.com/whyrusleeping/cbor-gen"

"github.com/filecoin-project/go-address"

"github.com/filecoin-project/lotus/itests/kit"
)

Expand Down
6 changes: 4 additions & 2 deletions itests/kit/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ import (
"context"
"encoding/binary"

"github.com/stretchr/testify/require"
cbg "github.com/whyrusleeping/cbor-gen"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
builtintypes "github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/go-state-types/builtin/v10/eam"

"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/types"
"github.com/stretchr/testify/require"
cbg "github.com/whyrusleeping/cbor-gen"
)

// EVM groups EVM-related actions.
Expand Down

0 comments on commit fdf546b

Please sign in to comment.