accounts/abi: trim whitespace

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
jsvisa 2025-03-26 23:47:34 +08:00
parent 7e3170fb5c
commit 31973e5aa1

View file

@ -541,7 +541,7 @@ var bindTests = []struct {
struct A { struct A {
bytes32 B; bytes32 B;
} }
function F() public view returns (A[] memory a, uint256[] memory c, bool[] memory d) { function F() public view returns (A[] memory a, uint256[] memory c, bool[] memory d) {
A[] memory a = new A[](2); A[] memory a = new A[](2);
a[0].B = bytes32(uint256(1234) << 96); a[0].B = bytes32(uint256(1234) << 96);
@ -549,7 +549,7 @@ var bindTests = []struct {
bool[] memory d; bool[] memory d;
return (a, c, d); return (a, c, d);
} }
function G() public view returns (A[] memory a) { function G() public view returns (A[] memory a) {
A[] memory a = new A[](2); A[] memory a = new A[](2);
a[0].B = bytes32(uint256(1234) << 96); a[0].B = bytes32(uint256(1234) << 96);
@ -571,10 +571,10 @@ var bindTests = []struct {
// Generate a new random account and a funded simulator // Generate a new random account and a funded simulator
key, _ := crypto.GenerateKey() key, _ := crypto.GenerateKey()
auth, _ := bind.NewKeyedTransactorWithChainID(key, big.NewInt(1337)) auth, _ := bind.NewKeyedTransactorWithChainID(key, big.NewInt(1337))
sim := backends.NewSimulatedBackend(types.GenesisAlloc{auth.From: {Balance: big.NewInt(10000000000000000)}}, 10000000) sim := backends.NewSimulatedBackend(types.GenesisAlloc{auth.From: {Balance: big.NewInt(10000000000000000)}}, 10000000)
defer sim.Close() defer sim.Close()
// Deploy a structs method invoker contract and execute its default method // Deploy a structs method invoker contract and execute its default method
_, _, structs, err := DeployStructs(auth, sim) _, _, structs, err := DeployStructs(auth, sim)
if err != nil { if err != nil {
@ -1701,13 +1701,13 @@ var bindTests = []struct {
`NewFallbacks`, `NewFallbacks`,
` `
pragma solidity >=0.6.0 <0.7.0; pragma solidity >=0.6.0 <0.7.0;
contract NewFallbacks { contract NewFallbacks {
event Fallback(bytes data); event Fallback(bytes data);
fallback() external { fallback() external {
emit Fallback(msg.data); emit Fallback(msg.data);
} }
event Received(address addr, uint value); event Received(address addr, uint value);
receive() external payable { receive() external payable {
emit Received(msg.sender, msg.value); emit Received(msg.sender, msg.value);
@ -1719,7 +1719,7 @@ var bindTests = []struct {
` `
"bytes" "bytes"
"math/big" "math/big"
"github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends" "github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
@ -1728,22 +1728,22 @@ var bindTests = []struct {
` `
key, _ := crypto.GenerateKey() key, _ := crypto.GenerateKey()
addr := crypto.PubkeyToAddress(key.PublicKey) addr := crypto.PubkeyToAddress(key.PublicKey)
sim := backends.NewSimulatedBackend(types.GenesisAlloc{addr: {Balance: big.NewInt(10000000000000000)}}, 1000000) sim := backends.NewSimulatedBackend(types.GenesisAlloc{addr: {Balance: big.NewInt(10000000000000000)}}, 1000000)
defer sim.Close() defer sim.Close()
opts, _ := bind.NewKeyedTransactorWithChainID(key, big.NewInt(1337)) opts, _ := bind.NewKeyedTransactorWithChainID(key, big.NewInt(1337))
_, _, c, err := DeployNewFallbacks(opts, sim) _, _, c, err := DeployNewFallbacks(opts, sim)
if err != nil { if err != nil {
t.Fatalf("Failed to deploy contract: %v", err) t.Fatalf("Failed to deploy contract: %v", err)
} }
sim.Commit() sim.Commit()
// Test receive function // Test receive function
opts.Value = big.NewInt(100) opts.Value = big.NewInt(100)
c.Receive(opts) c.Receive(opts)
sim.Commit() sim.Commit()
var gotEvent bool var gotEvent bool
iter, _ := c.FilterReceived(nil) iter, _ := c.FilterReceived(nil)
defer iter.Close() defer iter.Close()
@ -1760,14 +1760,14 @@ var bindTests = []struct {
if !gotEvent { if !gotEvent {
t.Fatal("Expect to receive event emitted by receive") t.Fatal("Expect to receive event emitted by receive")
} }
// Test fallback function // Test fallback function
gotEvent = false gotEvent = false
opts.Value = nil opts.Value = nil
calldata := []byte{0x01, 0x02, 0x03} calldata := []byte{0x01, 0x02, 0x03}
c.Fallback(opts, calldata) c.Fallback(opts, calldata)
sim.Commit() sim.Commit()
iter2, _ := c.FilterFallback(nil) iter2, _ := c.FilterFallback(nil)
defer iter2.Close() defer iter2.Close()
for iter2.Next() { for iter2.Next() {
@ -1862,7 +1862,7 @@ var bindTests = []struct {
`NewErrors`, `NewErrors`,
` `
pragma solidity >0.8.4; pragma solidity >0.8.4;
contract NewErrors { contract NewErrors {
error MyError(uint256); error MyError(uint256);
error MyError1(uint256); error MyError1(uint256);
@ -1878,7 +1878,7 @@ var bindTests = []struct {
` `
"context" "context"
"math/big" "math/big"
"github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends" "github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
@ -1892,7 +1892,7 @@ var bindTests = []struct {
sim = backends.NewSimulatedBackend(types.GenesisAlloc{user.From: {Balance: big.NewInt(1000000000000000000)}}, ethconfig.Defaults.Miner.GasCeil) sim = backends.NewSimulatedBackend(types.GenesisAlloc{user.From: {Balance: big.NewInt(1000000000000000000)}}, ethconfig.Defaults.Miner.GasCeil)
) )
defer sim.Close() defer sim.Close()
_, tx, contract, err := DeployNewErrors(user, sim) _, tx, contract, err := DeployNewErrors(user, sim)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
@ -1917,12 +1917,12 @@ var bindTests = []struct {
name: `ConstructorWithStructParam`, name: `ConstructorWithStructParam`,
contract: ` contract: `
pragma solidity >=0.8.0 <0.9.0; pragma solidity >=0.8.0 <0.9.0;
contract ConstructorWithStructParam { contract ConstructorWithStructParam {
struct StructType { struct StructType {
uint256 field; uint256 field;
} }
constructor(StructType memory st) {} constructor(StructType memory st) {}
} }
`, `,
@ -1951,7 +1951,7 @@ var bindTests = []struct {
t.Fatalf("DeployConstructorWithStructParam() got err %v; want nil err", err) t.Fatalf("DeployConstructorWithStructParam() got err %v; want nil err", err)
} }
sim.Commit() sim.Commit()
if _, err = bind.WaitDeployed(context.Background(), sim, tx); err != nil { if _, err = bind.WaitDeployed(context.Background(), sim, tx); err != nil {
t.Logf("Deployment tx: %+v", tx) t.Logf("Deployment tx: %+v", tx)
t.Errorf("bind.WaitDeployed(nil, %T, <deployment tx>) got err %v; want nil err", sim, err) t.Errorf("bind.WaitDeployed(nil, %T, <deployment tx>) got err %v; want nil err", sim, err)
@ -2000,7 +2000,7 @@ var bindTests = []struct {
t.Fatalf("DeployNameConflict() got err %v; want nil err", err) t.Fatalf("DeployNameConflict() got err %v; want nil err", err)
} }
sim.Commit() sim.Commit()
if _, err = bind.WaitDeployed(context.Background(), sim, tx); err != nil { if _, err = bind.WaitDeployed(context.Background(), sim, tx); err != nil {
t.Logf("Deployment tx: %+v", tx) t.Logf("Deployment tx: %+v", tx)
t.Errorf("bind.WaitDeployed(nil, %T, <deployment tx>) got err %v; want nil err", sim, err) t.Errorf("bind.WaitDeployed(nil, %T, <deployment tx>) got err %v; want nil err", sim, err)