-
Notifications
You must be signed in to change notification settings - Fork 21.2k
Closed
Labels
Description
This unit test is flaky and occasionally fails. After investigating, I found that event logs might not be found immediately after committing the transaction. There may be an underlying data race causing this issue.
package main
import (
"context"
"math/big"
"reflect"
"testing"
"time"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethereum/contract/debug"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
)
func TestGoo(t *testing.T) {
key, _ := crypto.GenerateKey()
auth, _ := bind.NewKeyedTransactorWithChainID(key, big.NewInt(1337))
sim := backends.NewSimulatedBackend(types.GenesisAlloc{auth.From: {Balance: big.NewInt(10000000000000000)}}, 10000000)
defer sim.Close()
_, _, contract, err := debug.DeployDebug(auth, sim)
if err != nil {
t.Fatalf("deploy contract failed %v", err)
}
sim.Commit()
check := func(a, b interface{}, errMsg string) {
if !reflect.DeepEqual(a, b) {
t.Fatal(errMsg)
}
}
a := debug.TupleS{
A: big.NewInt(1),
B: []*big.Int{big.NewInt(2), big.NewInt(3)},
C: []debug.TupleT{
{
X: big.NewInt(4),
Y: big.NewInt(5),
},
{
X: big.NewInt(6),
Y: big.NewInt(7),
},
},
}
b := [][2]debug.TupleT{
{
{
X: big.NewInt(8),
Y: big.NewInt(9),
},
{
X: big.NewInt(10),
Y: big.NewInt(11),
},
},
}
c := [2][]debug.TupleT{
{
{
X: big.NewInt(12),
Y: big.NewInt(13),
},
{
X: big.NewInt(14),
Y: big.NewInt(15),
},
},
{
{
X: big.NewInt(16),
Y: big.NewInt(17),
},
},
}
d := []debug.TupleS{a}
e := []*big.Int{big.NewInt(18), big.NewInt(19)}
ret1, ret2, ret3, ret4, ret5, err := contract.Func1(nil, a, b, c, d, e)
if err != nil {
t.Fatalf("invoke contract failed, err %v", err)
}
check(ret1, a, "ret1 mismatch")
check(ret2, b, "ret2 mismatch")
check(ret3, c, "ret3 mismatch")
check(ret4, d, "ret4 mismatch")
check(ret5, e, "ret5 mismatch")
n, err := sim.BlockNumber(context.Background())
if err != nil {
t.Fatalf("failed to get chain head, err %v", err)
}
if n != 1 {
t.Fatalf("block number mismatch, got %d", n)
}
_, err = contract.Func2(auth, a, b, c, d, e)
if err != nil {
t.Fatalf("invoke contract failed, err %v", err)
}
sim.Commit()
n, err = sim.BlockNumber(context.Background())
if err != nil {
t.Fatalf("failed to get chain head, err %v", err)
}
if n != 2 {
t.Fatalf("block number mismatch, got %d", n)
}
time.Sleep(time.Second)
iter, err := contract.FilterTupleEvent(nil)
if err != nil {
t.Fatalf("failed to create event filter, err %v", err)
}
defer iter.Close()
if !iter.Next() {
t.Fatal("Failed to move iterator forward")
}
if iter.Event == nil {
t.Fatal("No contract event attached")
}
check(iter.Event.A, a, "field1 mismatch")
check(iter.Event.B, b, "field2 mismatch")
check(iter.Event.C, c, "field3 mismatch")
check(iter.Event.D, d, "field4 mismatch")
check(iter.Event.E, e, "field5 mismatch")
err = contract.Func3(nil, nil)
if err != nil {
t.Fatalf("failed to call function which has no return, err %v", err)
}
}
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package debug
import (
"errors"
"math/big"
"strings"
ethereum "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/event"
)
// Reference imports to suppress errors if they are not otherwise used.
var (
_ = errors.New
_ = big.NewInt
_ = strings.NewReader
_ = ethereum.NotFound
_ = bind.Bind
_ = common.Big1
_ = types.BloomLookup
_ = event.NewSubscription
_ = abi.ConvertType
)
// TupleP is an auto generated low-level Go binding around an user-defined struct.
type TupleP struct {
X uint8
Y uint8
}
// TupleQ is an auto generated low-level Go binding around an user-defined struct.
type TupleQ struct {
X uint16
Y uint16
}
// TupleS is an auto generated low-level Go binding around an user-defined struct.
type TupleS struct {
A *big.Int
B []*big.Int
C []TupleT
}
// TupleT is an auto generated low-level Go binding around an user-defined struct.
type TupleT struct {
X *big.Int
Y *big.Int
}
// DebugMetaData contains all meta data concerning the Debug contract.
var DebugMetaData = &bind.MetaData{
ABI: "[{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"a\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"b\",\"type\":\"uint256[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"}],\"internalType\":\"structTuple.T[]\",\"name\":\"c\",\"type\":\"tuple[]\"}],\"indexed\":false,\"internalType\":\"structTuple.S\",\"name\":\"a\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structTuple.T[2][]\",\"name\":\"b\",\"type\":\"tuple[2][]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structTuple.T[][2]\",\"name\":\"c\",\"type\":\"tuple[][2]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"a\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"b\",\"type\":\"uint256[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"}],\"internalType\":\"structTuple.T[]\",\"name\":\"c\",\"type\":\"tuple[]\"}],\"indexed\":false,\"internalType\":\"structTuple.S[]\",\"name\":\"d\",\"type\":\"tuple[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"e\",\"type\":\"uint256[]\"}],\"name\":\"TupleEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"uint8\",\"name\":\"x\",\"type\":\"uint8\"},{\"internalType\":\"uint8\",\"name\":\"y\",\"type\":\"uint8\"}],\"indexed\":false,\"internalType\":\"structTuple.P[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"name\":\"TupleEvent2\",\"type\":\"event\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"a\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"b\",\"type\":\"uint256[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"}],\"internalType\":\"structTuple.T[]\",\"name\":\"c\",\"type\":\"tuple[]\"}],\"internalType\":\"structTuple.S\",\"name\":\"a\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"}],\"internalType\":\"structTuple.T[2][]\",\"name\":\"b\",\"type\":\"tuple[2][]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"}],\"internalType\":\"structTuple.T[][2]\",\"name\":\"c\",\"type\":\"tuple[][2]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"a\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"b\",\"type\":\"uint256[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"}],\"internalType\":\"structTuple.T[]\",\"name\":\"c\",\"type\":\"tuple[]\"}],\"internalType\":\"structTuple.S[]\",\"name\":\"d\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256[]\",\"name\":\"e\",\"type\":\"uint256[]\"}],\"name\":\"func1\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"a\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"b\",\"type\":\"uint256[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"}],\"internalType\":\"structTuple.T[]\",\"name\":\"c\",\"type\":\"tuple[]\"}],\"internalType\":\"structTuple.S\",\"name\":\"\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"}],\"internalType\":\"structTuple.T[2][]\",\"name\":\"\",\"type\":\"tuple[2][]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"}],\"internalType\":\"structTuple.T[][2]\",\"name\":\"\",\"type\":\"tuple[][2]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"a\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"b\",\"type\":\"uint256[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"}],\"internalType\":\"structTuple.T[]\",\"name\":\"c\",\"type\":\"tuple[]\"}],\"internalType\":\"structTuple.S[]\",\"name\":\"\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"a\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"b\",\"type\":\"uint256[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"}],\"internalType\":\"structTuple.T[]\",\"name\":\"c\",\"type\":\"tuple[]\"}],\"internalType\":\"structTuple.S\",\"name\":\"a\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"}],\"internalType\":\"structTuple.T[2][]\",\"name\":\"b\",\"type\":\"tuple[2][]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"}],\"internalType\":\"structTuple.T[][2]\",\"name\":\"c\",\"type\":\"tuple[][2]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"a\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"b\",\"type\":\"uint256[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"}],\"internalType\":\"structTuple.T[]\",\"name\":\"c\",\"type\":\"tuple[]\"}],\"internalType\":\"structTuple.S[]\",\"name\":\"d\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256[]\",\"name\":\"e\",\"type\":\"uint256[]\"}],\"name\":\"func2\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"internalType\":\"uint16\",\"name\":\"x\",\"type\":\"uint16\"},{\"internalType\":\"uint16\",\"name\":\"y\",\"type\":\"uint16\"}],\"internalType\":\"structTuple.Q[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"name\":\"func3\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"}]",
Bin: "0x60806040523480156100115760006000fd5b50610017565b6110b2806100266000396000f3fe60806040523480156100115760006000fd5b50600436106100465760003560e01c8063443c79b41461004c578063d0062cdd14610080578063e4d9a43b1461009c57610046565b60006000fd5b610066600480360361006191908101906107b8565b6100b8565b604051610077959493929190610ccb565b60405180910390f35b61009a600480360361009591908101906107b8565b6100ef565b005b6100b660048036036100b19190810190610775565b610136565b005b6100c061013a565b60606100ca61015e565b606060608989898989945094509450945094506100e2565b9550955095509550959050565b7f18d6e66efa53739ca6d13626f35ebc700b31cced3eddb50c70bbe9c082c6cd008585858585604051610126959493929190610ccb565b60405180910390a15b5050505050565b5b50565b60405180606001604052806000815260200160608152602001606081526020015090565b60405180604001604052806002905b606081526020019060019003908161016d57905050905661106e565b600082601f830112151561019d5760006000fd5b81356101b06101ab82610d6f565b610d41565b915081818352602084019350602081019050838560808402820111156101d65760006000fd5b60005b8381101561020757816101ec888261037a565b8452602084019350608083019250505b6001810190506101d9565b5050505092915050565b600082601f83011215156102255760006000fd5b600261023861023382610d98565b610d41565b9150818360005b83811015610270578135860161025588826103f3565b8452602084019350602083019250505b60018101905061023f565b5050505092915050565b600082601f830112151561028e5760006000fd5b81356102a161029c82610dbb565b610d41565b915081818352602084019350602081019050838560408402820111156102c75760006000fd5b60005b838110156102f857816102dd888261058b565b8452602084019350604083019250505b6001810190506102ca565b5050505092915050565b600082601f83011215156103165760006000fd5b813561032961032482610de4565b610d41565b9150818183526020840193506020810190508360005b83811015610370578135860161035588826105d8565b8452602084019350602083019250505b60018101905061033f565b5050505092915050565b600082601f830112151561038e5760006000fd5b60026103a161039c82610e0d565b610d41565b915081838560408402820111156103b85760006000fd5b60005b838110156103e957816103ce88826106fe565b8452602084019350604083019250505b6001810190506103bb565b5050505092915050565b600082601f83011215156104075760006000fd5b813561041a61041582610e30565b610d41565b915081818352602084019350602081019050838560408402820111156104405760006000fd5b60005b83811015610471578161045688826106fe565b8452602084019350604083019250505b600181019050610443565b5050505092915050565b600082601f830112151561048f5760006000fd5b81356104a261049d82610e59565b610d41565b915081818352602084019350602081019050838560208402820111156104c85760006000fd5b60005b838110156104f957816104de8882610760565b8452602084019350602083019250505b6001810190506104cb565b5050505092915050565b600082601f83011215156105175760006000fd5b813561052a61052582610e82565b610d41565b915081818352602084019350602081019050838560208402820111156105505760006000fd5b60005b8381101561058157816105668882610760565b8452602084019350602083019250505b600181019050610553565b5050505092915050565b60006040828403121561059e5760006000fd5b6105a86040610d41565b905060006105b88482850161074b565b60008301525060206105cc8482850161074b565b60208301525092915050565b6000606082840312156105eb5760006000fd5b6105f56060610d41565b9050600061060584828501610760565b600083015250602082013567ffffffffffffffff8111156106265760006000fd5b6106328482850161047b565b602083015250604082013567ffffffffffffffff8111156106535760006000fd5b61065f848285016103f3565b60408301525092915050565b60006060828403121561067e5760006000fd5b6106886060610d41565b9050600061069884828501610760565b600083015250602082013567ffffffffffffffff8111156106b95760006000fd5b6106c58482850161047b565b602083015250604082013567ffffffffffffffff8111156106e65760006000fd5b6106f2848285016103f3565b60408301525092915050565b6000604082840312156107115760006000fd5b61071b6040610d41565b9050600061072b84828501610760565b600083015250602061073f84828501610760565b60208301525092915050565b60008135905061075a8161103a565b92915050565b60008135905061076f81611054565b92915050565b6000602082840312156107885760006000fd5b600082013567ffffffffffffffff8111156107a35760006000fd5b6107af8482850161027a565b91505092915050565b6000600060006000600060a086880312156107d35760006000fd5b600086013567ffffffffffffffff8111156107ee5760006000fd5b6107fa8882890161066b565b955050602086013567ffffffffffffffff8111156108185760006000fd5b61082488828901610189565b945050604086013567ffffffffffffffff8111156108425760006000fd5b61084e88828901610211565b935050606086013567ffffffffffffffff81111561086c5760006000fd5b61087888828901610302565b925050608086013567ffffffffffffffff8111156108965760006000fd5b6108a288828901610503565b9150509295509295909350565b60006108bb8383610a6a565b60808301905092915050565b60006108d38383610ac2565b905092915050565b60006108e78383610c36565b905092915050565b60006108fb8383610c8d565b60408301905092915050565b60006109138383610cbc565b60208301905092915050565b600061092a82610f0f565b6109348185610fb7565b935061093f83610eab565b8060005b8381101561097157815161095788826108af565b975061096283610f5c565b9250505b600181019050610943565b5085935050505092915050565b600061098982610f1a565b6109938185610fc8565b9350836020820285016109a585610ebb565b8060005b858110156109e257848403895281516109c285826108c7565b94506109cd83610f69565b925060208a019950505b6001810190506109a9565b50829750879550505050505092915050565b60006109ff82610f25565b610a098185610fd3565b935083602082028501610a1b85610ec5565b8060005b85811015610a585784840389528151610a3885826108db565b9450610a4383610f76565b925060208a019950505b600181019050610a1f565b50829750879550505050505092915050565b610a7381610f30565b610a7d8184610fe4565b9250610a8882610ed5565b8060005b83811015610aba578151610aa087826108ef565b9650610aab83610f83565b9250505b600181019050610a8c565b505050505050565b6000610acd82610f3b565b610ad78185610fef565b9350610ae283610edf565b8060005b83811015610b14578151610afa88826108ef565b9750610b0583610f90565b9250505b600181019050610ae6565b5085935050505092915050565b6000610b2c82610f51565b610b368185611011565b9350610b4183610eff565b8060005b83811015610b73578151610b598882610907565b9750610b6483610faa565b9250505b600181019050610b45565b5085935050505092915050565b6000610b8b82610f46565b610b958185611000565b9350610ba083610eef565b8060005b83811015610bd2578151610bb88882610907565b9750610bc383610f9d565b9250505b600181019050610ba4565b5085935050505092915050565b6000606083016000830151610bf76000860182610cbc565b5060208301518482036020860152610c0f8282610b80565b91505060408301518482036040860152610c298282610ac2565b9150508091505092915050565b6000606083016000830151610c4e6000860182610cbc565b5060208301518482036020860152610c668282610b80565b91505060408301518482036040860152610c808282610ac2565b9150508091505092915050565b604082016000820151610ca36000850182610cbc565b506020820151610cb66020850182610cbc565b50505050565b610cc581611030565b82525050565b600060a0820190508181036000830152610ce58188610bdf565b90508181036020830152610cf9818761091f565b90508181036040830152610d0d818661097e565b90508181036060830152610d2181856109f4565b90508181036080830152610d358184610b21565b90509695505050505050565b6000604051905081810181811067ffffffffffffffff82111715610d655760006000fd5b8060405250919050565b600067ffffffffffffffff821115610d875760006000fd5b602082029050602081019050919050565b600067ffffffffffffffff821115610db05760006000fd5b602082029050919050565b600067ffffffffffffffff821115610dd35760006000fd5b602082029050602081019050919050565b600067ffffffffffffffff821115610dfc5760006000fd5b602082029050602081019050919050565b600067ffffffffffffffff821115610e255760006000fd5b602082029050919050565b600067ffffffffffffffff821115610e485760006000fd5b602082029050602081019050919050565b600067ffffffffffffffff821115610e715760006000fd5b602082029050602081019050919050565b600067ffffffffffffffff821115610e9a5760006000fd5b602082029050602081019050919050565b6000819050602082019050919050565b6000819050919050565b6000819050602082019050919050565b6000819050919050565b6000819050602082019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600060029050919050565b600081519050919050565b600060029050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600061ffff82169050919050565b6000819050919050565b61104381611022565b811415156110515760006000fd5b50565b61105d81611030565b8114151561106b5760006000fd5b50565bfea365627a7a72315820d78c6ba7ee332581e6c4d9daa5fc07941841230f7ce49edf6e05b1b63853e8746c6578706572696d656e74616cf564736f6c634300050c0040",
}
// DebugABI is the input ABI used to generate the binding from.
// Deprecated: Use DebugMetaData.ABI instead.
var DebugABI = DebugMetaData.ABI
// DebugBin is the compiled bytecode used for deploying new contracts.
// Deprecated: Use DebugMetaData.Bin instead.
var DebugBin = DebugMetaData.Bin
// DeployDebug deploys a new Ethereum contract, binding an instance of Debug to it.
func DeployDebug(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Debug, error) {
parsed, err := DebugMetaData.GetAbi()
if err != nil {
return common.Address{}, nil, nil, err
}
if parsed == nil {
return common.Address{}, nil, nil, errors.New("GetABI returned nil")
}
address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(DebugBin), backend)
if err != nil {
return common.Address{}, nil, nil, err
}
return address, tx, &Debug{DebugCaller: DebugCaller{contract: contract}, DebugTransactor: DebugTransactor{contract: contract}, DebugFilterer: DebugFilterer{contract: contract}}, nil
}
// Debug is an auto generated Go binding around an Ethereum contract.
type Debug struct {
DebugCaller // Read-only binding to the contract
DebugTransactor // Write-only binding to the contract
DebugFilterer // Log filterer for contract events
}
// DebugCaller is an auto generated read-only Go binding around an Ethereum contract.
type DebugCaller struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// DebugTransactor is an auto generated write-only Go binding around an Ethereum contract.
type DebugTransactor struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// DebugFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
type DebugFilterer struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// DebugSession is an auto generated Go binding around an Ethereum contract,
// with pre-set call and transact options.
type DebugSession struct {
Contract *Debug // Generic contract binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
// DebugCallerSession is an auto generated read-only Go binding around an Ethereum contract,
// with pre-set call options.
type DebugCallerSession struct {
Contract *DebugCaller // Generic contract caller binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
}
// DebugTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
// with pre-set transact options.
type DebugTransactorSession struct {
Contract *DebugTransactor // Generic contract transactor binding to set the session for
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
// DebugRaw is an auto generated low-level Go binding around an Ethereum contract.
type DebugRaw struct {
Contract *Debug // Generic contract binding to access the raw methods on
}
// DebugCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
type DebugCallerRaw struct {
Contract *DebugCaller // Generic read-only contract binding to access the raw methods on
}
// DebugTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
type DebugTransactorRaw struct {
Contract *DebugTransactor // Generic write-only contract binding to access the raw methods on
}
// NewDebug creates a new instance of Debug, bound to a specific deployed contract.
func NewDebug(address common.Address, backend bind.ContractBackend) (*Debug, error) {
contract, err := bindDebug(address, backend, backend, backend)
if err != nil {
return nil, err
}
return &Debug{DebugCaller: DebugCaller{contract: contract}, DebugTransactor: DebugTransactor{contract: contract}, DebugFilterer: DebugFilterer{contract: contract}}, nil
}
// NewDebugCaller creates a new read-only instance of Debug, bound to a specific deployed contract.
func NewDebugCaller(address common.Address, caller bind.ContractCaller) (*DebugCaller, error) {
contract, err := bindDebug(address, caller, nil, nil)
if err != nil {
return nil, err
}
return &DebugCaller{contract: contract}, nil
}
// NewDebugTransactor creates a new write-only instance of Debug, bound to a specific deployed contract.
func NewDebugTransactor(address common.Address, transactor bind.ContractTransactor) (*DebugTransactor, error) {
contract, err := bindDebug(address, nil, transactor, nil)
if err != nil {
return nil, err
}
return &DebugTransactor{contract: contract}, nil
}
// NewDebugFilterer creates a new log filterer instance of Debug, bound to a specific deployed contract.
func NewDebugFilterer(address common.Address, filterer bind.ContractFilterer) (*DebugFilterer, error) {
contract, err := bindDebug(address, nil, nil, filterer)
if err != nil {
return nil, err
}
return &DebugFilterer{contract: contract}, nil
}
// bindDebug binds a generic wrapper to an already deployed contract.
func bindDebug(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
parsed, err := DebugMetaData.GetAbi()
if err != nil {
return nil, err
}
return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil
}
// Call invokes the (constant) contract method with params as input values and
// sets the output to result. The result type might be a single field for simple
// returns, a slice of interfaces for anonymous returns and a struct for named
// returns.
func (_Debug *DebugRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _Debug.Contract.DebugCaller.contract.Call(opts, result, method, params...)
}
// Transfer initiates a plain transaction to move funds to the contract, calling
// its default method if one is available.
func (_Debug *DebugRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _Debug.Contract.DebugTransactor.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_Debug *DebugRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _Debug.Contract.DebugTransactor.contract.Transact(opts, method, params...)
}
// Call invokes the (constant) contract method with params as input values and
// sets the output to result. The result type might be a single field for simple
// returns, a slice of interfaces for anonymous returns and a struct for named
// returns.
func (_Debug *DebugCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
return _Debug.Contract.contract.Call(opts, result, method, params...)
}
// Transfer initiates a plain transaction to move funds to the contract, calling
// its default method if one is available.
func (_Debug *DebugTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _Debug.Contract.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_Debug *DebugTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _Debug.Contract.contract.Transact(opts, method, params...)
}
// Func1 is a free data retrieval call binding the contract method 0x443c79b4.
//
// Solidity: function func1((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) pure returns((uint256,uint256[],(uint256,uint256)[]), (uint256,uint256)[2][], (uint256,uint256)[][2], (uint256,uint256[],(uint256,uint256)[])[], uint256[])
func (_Debug *DebugCaller) Func1(opts *bind.CallOpts, a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) (TupleS, [][2]TupleT, [2][]TupleT, []TupleS, []*big.Int, error) {
var out []interface{}
err := _Debug.contract.Call(opts, &out, "func1", a, b, c, d, e)
if err != nil {
return *new(TupleS), *new([][2]TupleT), *new([2][]TupleT), *new([]TupleS), *new([]*big.Int), err
}
out0 := *abi.ConvertType(out[0], new(TupleS)).(*TupleS)
out1 := *abi.ConvertType(out[1], new([][2]TupleT)).(*[][2]TupleT)
out2 := *abi.ConvertType(out[2], new([2][]TupleT)).(*[2][]TupleT)
out3 := *abi.ConvertType(out[3], new([]TupleS)).(*[]TupleS)
out4 := *abi.ConvertType(out[4], new([]*big.Int)).(*[]*big.Int)
return out0, out1, out2, out3, out4, err
}
// Func1 is a free data retrieval call binding the contract method 0x443c79b4.
//
// Solidity: function func1((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) pure returns((uint256,uint256[],(uint256,uint256)[]), (uint256,uint256)[2][], (uint256,uint256)[][2], (uint256,uint256[],(uint256,uint256)[])[], uint256[])
func (_Debug *DebugSession) Func1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) (TupleS, [][2]TupleT, [2][]TupleT, []TupleS, []*big.Int, error) {
return _Debug.Contract.Func1(&_Debug.CallOpts, a, b, c, d, e)
}
// Func1 is a free data retrieval call binding the contract method 0x443c79b4.
//
// Solidity: function func1((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) pure returns((uint256,uint256[],(uint256,uint256)[]), (uint256,uint256)[2][], (uint256,uint256)[][2], (uint256,uint256[],(uint256,uint256)[])[], uint256[])
func (_Debug *DebugCallerSession) Func1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) (TupleS, [][2]TupleT, [2][]TupleT, []TupleS, []*big.Int, error) {
return _Debug.Contract.Func1(&_Debug.CallOpts, a, b, c, d, e)
}
// Func3 is a free data retrieval call binding the contract method 0xe4d9a43b.
//
// Solidity: function func3((uint16,uint16)[] ) pure returns()
func (_Debug *DebugCaller) Func3(opts *bind.CallOpts, arg0 []TupleQ) error {
var out []interface{}
err := _Debug.contract.Call(opts, &out, "func3", arg0)
if err != nil {
return err
}
return err
}
// Func3 is a free data retrieval call binding the contract method 0xe4d9a43b.
//
// Solidity: function func3((uint16,uint16)[] ) pure returns()
func (_Debug *DebugSession) Func3(arg0 []TupleQ) error {
return _Debug.Contract.Func3(&_Debug.CallOpts, arg0)
}
// Func3 is a free data retrieval call binding the contract method 0xe4d9a43b.
//
// Solidity: function func3((uint16,uint16)[] ) pure returns()
func (_Debug *DebugCallerSession) Func3(arg0 []TupleQ) error {
return _Debug.Contract.Func3(&_Debug.CallOpts, arg0)
}
// Func2 is a paid mutator transaction binding the contract method 0xd0062cdd.
//
// Solidity: function func2((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) returns()
func (_Debug *DebugTransactor) Func2(opts *bind.TransactOpts, a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) (*types.Transaction, error) {
return _Debug.contract.Transact(opts, "func2", a, b, c, d, e)
}
// Func2 is a paid mutator transaction binding the contract method 0xd0062cdd.
//
// Solidity: function func2((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) returns()
func (_Debug *DebugSession) Func2(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) (*types.Transaction, error) {
return _Debug.Contract.Func2(&_Debug.TransactOpts, a, b, c, d, e)
}
// Func2 is a paid mutator transaction binding the contract method 0xd0062cdd.
//
// Solidity: function func2((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) returns()
func (_Debug *DebugTransactorSession) Func2(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) (*types.Transaction, error) {
return _Debug.Contract.Func2(&_Debug.TransactOpts, a, b, c, d, e)
}
// DebugTupleEventIterator is returned from FilterTupleEvent and is used to iterate over the raw logs and unpacked data for TupleEvent events raised by the Debug contract.
type DebugTupleEventIterator struct {
Event *DebugTupleEvent // Event containing the contract specifics and raw log
contract *bind.BoundContract // Generic contract to use for unpacking event data
event string // Event name to use for unpacking event data
logs chan types.Log // Log channel receiving the found contract events
sub ethereum.Subscription // Subscription for errors, completion and termination
done bool // Whether the subscription completed delivering logs
fail error // Occurred error to stop iteration
}
// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *DebugTupleEventIterator) Next() bool {
// If the iterator failed, stop iterating
if it.fail != nil {
return false
}
// If the iterator completed, deliver directly whatever's available
if it.done {
select {
case log := <-it.logs:
it.Event = new(DebugTupleEvent)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
default:
return false
}
}
// Iterator still in progress, wait for either a data or an error event
select {
case log := <-it.logs:
it.Event = new(DebugTupleEvent)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
case err := <-it.sub.Err():
it.done = true
it.fail = err
return it.Next()
}
}
// Error returns any retrieval or parsing error occurred during filtering.
func (it *DebugTupleEventIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *DebugTupleEventIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// DebugTupleEvent represents a TupleEvent event raised by the Debug contract.
type DebugTupleEvent struct {
A TupleS
B [][2]TupleT
C [2][]TupleT
D []TupleS
E []*big.Int
Raw types.Log // Blockchain specific contextual infos
}
// FilterTupleEvent is a free log retrieval operation binding the contract event 0x18d6e66efa53739ca6d13626f35ebc700b31cced3eddb50c70bbe9c082c6cd00.
//
// Solidity: event TupleEvent((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e)
func (_Debug *DebugFilterer) FilterTupleEvent(opts *bind.FilterOpts) (*DebugTupleEventIterator, error) {
logs, sub, err := _Debug.contract.FilterLogs(opts, "TupleEvent")
if err != nil {
return nil, err
}
return &DebugTupleEventIterator{contract: _Debug.contract, event: "TupleEvent", logs: logs, sub: sub}, nil
}
// WatchTupleEvent is a free log subscription operation binding the contract event 0x18d6e66efa53739ca6d13626f35ebc700b31cced3eddb50c70bbe9c082c6cd00.
//
// Solidity: event TupleEvent((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e)
func (_Debug *DebugFilterer) WatchTupleEvent(opts *bind.WatchOpts, sink chan<- *DebugTupleEvent) (event.Subscription, error) {
logs, sub, err := _Debug.contract.WatchLogs(opts, "TupleEvent")
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(DebugTupleEvent)
if err := _Debug.contract.UnpackLog(event, "TupleEvent", log); err != nil {
return err
}
event.Raw = log
select {
case sink <- event:
case err := <-sub.Err():
return err
case <-quit:
return nil
}
case err := <-sub.Err():
return err
case <-quit:
return nil
}
}
}), nil
}
// ParseTupleEvent is a log parse operation binding the contract event 0x18d6e66efa53739ca6d13626f35ebc700b31cced3eddb50c70bbe9c082c6cd00.
//
// Solidity: event TupleEvent((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e)
func (_Debug *DebugFilterer) ParseTupleEvent(log types.Log) (*DebugTupleEvent, error) {
event := new(DebugTupleEvent)
if err := _Debug.contract.UnpackLog(event, "TupleEvent", log); err != nil {
return nil, err
}
event.Raw = log
return event, nil
}
// DebugTupleEvent2Iterator is returned from FilterTupleEvent2 and is used to iterate over the raw logs and unpacked data for TupleEvent2 events raised by the Debug contract.
type DebugTupleEvent2Iterator struct {
Event *DebugTupleEvent2 // Event containing the contract specifics and raw log
contract *bind.BoundContract // Generic contract to use for unpacking event data
event string // Event name to use for unpacking event data
logs chan types.Log // Log channel receiving the found contract events
sub ethereum.Subscription // Subscription for errors, completion and termination
done bool // Whether the subscription completed delivering logs
fail error // Occurred error to stop iteration
}
// Next advances the iterator to the subsequent event, returning whether there
// are any more events found. In case of a retrieval or parsing error, false is
// returned and Error() can be queried for the exact failure.
func (it *DebugTupleEvent2Iterator) Next() bool {
// If the iterator failed, stop iterating
if it.fail != nil {
return false
}
// If the iterator completed, deliver directly whatever's available
if it.done {
select {
case log := <-it.logs:
it.Event = new(DebugTupleEvent2)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
default:
return false
}
}
// Iterator still in progress, wait for either a data or an error event
select {
case log := <-it.logs:
it.Event = new(DebugTupleEvent2)
if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
it.fail = err
return false
}
it.Event.Raw = log
return true
case err := <-it.sub.Err():
it.done = true
it.fail = err
return it.Next()
}
}
// Error returns any retrieval or parsing error occurred during filtering.
func (it *DebugTupleEvent2Iterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *DebugTupleEvent2Iterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// DebugTupleEvent2 represents a TupleEvent2 event raised by the Debug contract.
type DebugTupleEvent2 struct {
Arg0 []TupleP
Raw types.Log // Blockchain specific contextual infos
}
// FilterTupleEvent2 is a free log retrieval operation binding the contract event 0x88833a3455c364501b6a838291e9240d528d80babaa9916b2cba73f4f95b8d50.
//
// Solidity: event TupleEvent2((uint8,uint8)[] arg0)
func (_Debug *DebugFilterer) FilterTupleEvent2(opts *bind.FilterOpts) (*DebugTupleEvent2Iterator, error) {
logs, sub, err := _Debug.contract.FilterLogs(opts, "TupleEvent2")
if err != nil {
return nil, err
}
return &DebugTupleEvent2Iterator{contract: _Debug.contract, event: "TupleEvent2", logs: logs, sub: sub}, nil
}
// WatchTupleEvent2 is a free log subscription operation binding the contract event 0x88833a3455c364501b6a838291e9240d528d80babaa9916b2cba73f4f95b8d50.
//
// Solidity: event TupleEvent2((uint8,uint8)[] arg0)
func (_Debug *DebugFilterer) WatchTupleEvent2(opts *bind.WatchOpts, sink chan<- *DebugTupleEvent2) (event.Subscription, error) {
logs, sub, err := _Debug.contract.WatchLogs(opts, "TupleEvent2")
if err != nil {
return nil, err
}
return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe()
for {
select {
case log := <-logs:
// New log arrived, parse the event and forward to the user
event := new(DebugTupleEvent2)
if err := _Debug.contract.UnpackLog(event, "TupleEvent2", log); err != nil {
return err
}
event.Raw = log
select {
case sink <- event:
case err := <-sub.Err():
return err
case <-quit:
return nil
}
case err := <-sub.Err():
return err
case <-quit:
return nil
}
}
}), nil
}
// ParseTupleEvent2 is a log parse operation binding the contract event 0x88833a3455c364501b6a838291e9240d528d80babaa9916b2cba73f4f95b8d50.
//
// Solidity: event TupleEvent2((uint8,uint8)[] arg0)
func (_Debug *DebugFilterer) ParseTupleEvent2(log types.Log) (*DebugTupleEvent2, error) {
event := new(DebugTupleEvent2)
if err := _Debug.contract.UnpackLog(event, "TupleEvent2", log); err != nil {
return nil, err
}
event.Raw = log
return event, nil
}