Skip to content

Commit 32aacc3

Browse files
style: revert some formatting (#294)
Revert "style: remove blank line & white space formatting" This reverts commit 349def8.
1 parent 09c69b6 commit 32aacc3

File tree

95 files changed

+775
-818
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+775
-818
lines changed

accounts/abi/abi_test.go

+14-20
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,8 @@ func TestInvalidABI(t *testing.T) {
165165

166166
// TestConstructor tests a constructor function.
167167
// The test is based on the following contract:
168-
//
169-
// contract TestConstructor {
170-
// constructor(uint256 a, uint256 b) public{}
168+
// contract TestConstructor {
169+
// constructor(uint256 a, uint256 b) public{}
171170
// }
172171
func TestConstructor(t *testing.T) {
173172
json := `[{ "inputs": [{"internalType": "uint256","name": "a","type": "uint256" },{ "internalType": "uint256","name": "b","type": "uint256"}],"stateMutability": "nonpayable","type": "constructor"}]`
@@ -725,19 +724,16 @@ func TestBareEvents(t *testing.T) {
725724
}
726725

727726
// TestUnpackEvent is based on this contract:
728-
//
729-
// contract T {
730-
// event received(address sender, uint amount, bytes memo);
731-
// event receivedAddr(address sender);
732-
// function receive(bytes memo) external payable {
733-
// received(msg.sender, msg.value, memo);
734-
// receivedAddr(msg.sender);
735-
// }
736-
// }
737-
//
727+
// contract T {
728+
// event received(address sender, uint amount, bytes memo);
729+
// event receivedAddr(address sender);
730+
// function receive(bytes memo) external payable {
731+
// received(msg.sender, msg.value, memo);
732+
// receivedAddr(msg.sender);
733+
// }
734+
// }
738735
// When receive("X") is called with sender 0x00... and value 1, it produces this tx receipt:
739-
//
740-
// receipt{status=1 cgas=23949 bloom=00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000040200000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[log: b6818c8064f645cd82d99b59a1a267d6d61117ef [75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed] 000000000000000000000000376c47978271565f56deb45495afa69e59c16ab200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000158 9ae378b6d4409eada347a5dc0c180f186cb62dc68fcc0f043425eb917335aa28 0 95d429d309bb9d753954195fe2d69bd140b4ae731b9b5b605c34323de162cf00 0]}
736+
// receipt{status=1 cgas=23949 bloom=00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000040200000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[log: b6818c8064f645cd82d99b59a1a267d6d61117ef [75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed] 000000000000000000000000376c47978271565f56deb45495afa69e59c16ab200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000158 9ae378b6d4409eada347a5dc0c180f186cb62dc68fcc0f043425eb917335aa28 0 95d429d309bb9d753954195fe2d69bd140b4ae731b9b5b605c34323de162cf00 0]}
741737
func TestUnpackEvent(t *testing.T) {
742738
const abiJSON = `[{"constant":false,"inputs":[{"name":"memo","type":"bytes"}],"name":"receive","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"sender","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"memo","type":"bytes"}],"name":"received","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"sender","type":"address"}],"name":"receivedAddr","type":"event"}]`
743739
abi, err := JSON(strings.NewReader(abiJSON))
@@ -1084,9 +1080,8 @@ func TestDoubleDuplicateMethodNames(t *testing.T) {
10841080
// TestDoubleDuplicateEventNames checks that if send0 already exists, there won't be a name
10851081
// conflict and that the second send event will be renamed send1.
10861082
// The test runs the abi of the following contract.
1087-
//
1088-
// contract DuplicateEvent {
1089-
// event send(uint256 a);
1083+
// contract DuplicateEvent {
1084+
// event send(uint256 a);
10901085
// event send0();
10911086
// event send();
10921087
// }
@@ -1113,8 +1108,7 @@ func TestDoubleDuplicateEventNames(t *testing.T) {
11131108
// TestUnnamedEventParam checks that an event with unnamed parameters is
11141109
// correctly handled.
11151110
// The test runs the abi of the following contract.
1116-
//
1117-
// contract TestEvent {
1111+
// contract TestEvent {
11181112
// event send(uint256, uint256);
11191113
// }
11201114
func TestUnnamedEventParam(t *testing.T) {

accounts/abi/bind/backends/simulated_test.go

+15-18
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,17 @@ func TestSimulatedBackend(t *testing.T) {
9393

9494
var testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
9595

96-
// the following is based on this contract:
97-
// contract T {
98-
// event received(address sender, uint amount, bytes memo);
99-
// event receivedAddr(address sender);
96+
// the following is based on this contract:
97+
// contract T {
98+
// event received(address sender, uint amount, bytes memo);
99+
// event receivedAddr(address sender);
100100
//
101-
// function receive(bytes calldata memo) external payable returns (string memory res) {
102-
// emit received(msg.sender, msg.value, memo);
103-
// emit receivedAddr(msg.sender);
104-
// return "hello world";
105-
// }
106-
// }
101+
// function receive(bytes calldata memo) external payable returns (string memory res) {
102+
// emit received(msg.sender, msg.value, memo);
103+
// emit receivedAddr(msg.sender);
104+
// return "hello world";
105+
// }
106+
// }
107107
const abiJSON = `[ { "constant": false, "inputs": [ { "name": "memo", "type": "bytes" } ], "name": "receive", "outputs": [ { "name": "res", "type": "string" } ], "payable": true, "stateMutability": "payable", "type": "function" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "sender", "type": "address" }, { "indexed": false, "name": "amount", "type": "uint256" }, { "indexed": false, "name": "memo", "type": "bytes" } ], "name": "received", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "sender", "type": "address" } ], "name": "receivedAddr", "type": "event" } ]`
108108
const abiBin = `0x608060405234801561001057600080fd5b506102a0806100206000396000f3fe60806040526004361061003b576000357c010000000000000000000000000000000000000000000000000000000090048063a69b6ed014610040575b600080fd5b6100b76004803603602081101561005657600080fd5b810190808035906020019064010000000081111561007357600080fd5b82018360208201111561008557600080fd5b803590602001918460018302840111640100000000831117156100a757600080fd5b9091929391929390505050610132565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f75780820151818401526020810190506100dc565b50505050905090810190601f1680156101245780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60607f75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed33348585604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509550505050505060405180910390a17f46923992397eac56cf13058aced2a1871933622717e27b24eabc13bf9dd329c833604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a16040805190810160405280600b81526020017f68656c6c6f20776f726c6400000000000000000000000000000000000000000081525090509291505056fea165627a7a72305820ff0c57dad254cfeda48c9cfb47f1353a558bccb4d1bc31da1dae69315772d29e0029`
109109
const deployedCode = `60806040526004361061003b576000357c010000000000000000000000000000000000000000000000000000000090048063a69b6ed014610040575b600080fd5b6100b76004803603602081101561005657600080fd5b810190808035906020019064010000000081111561007357600080fd5b82018360208201111561008557600080fd5b803590602001918460018302840111640100000000831117156100a757600080fd5b9091929391929390505050610132565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f75780820151818401526020810190506100dc565b50505050905090810190601f1680156101245780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60607f75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed33348585604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509550505050505060405180910390a17f46923992397eac56cf13058aced2a1871933622717e27b24eabc13bf9dd329c833604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a16040805190810160405280600b81526020017f68656c6c6f20776f726c6400000000000000000000000000000000000000000081525090509291505056fea165627a7a72305820ff0c57dad254cfeda48c9cfb47f1353a558bccb4d1bc31da1dae69315772d29e0029`
@@ -1015,8 +1015,7 @@ func TestCodeAt(t *testing.T) {
10151015
}
10161016

10171017
// When receive("X") is called with sender 0x00... and value 1, it produces this tx receipt:
1018-
//
1019-
// receipt{status=1 cgas=23949 bloom=00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000040200000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[log: b6818c8064f645cd82d99b59a1a267d6d61117ef [75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed] 000000000000000000000000376c47978271565f56deb45495afa69e59c16ab200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000158 9ae378b6d4409eada347a5dc0c180f186cb62dc68fcc0f043425eb917335aa28 0 95d429d309bb9d753954195fe2d69bd140b4ae731b9b5b605c34323de162cf00 0]}
1018+
// receipt{status=1 cgas=23949 bloom=00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000040200000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[log: b6818c8064f645cd82d99b59a1a267d6d61117ef [75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed] 000000000000000000000000376c47978271565f56deb45495afa69e59c16ab200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000158 9ae378b6d4409eada347a5dc0c180f186cb62dc68fcc0f043425eb917335aa28 0 95d429d309bb9d753954195fe2d69bd140b4ae731b9b5b605c34323de162cf00 0]}
10201019
func TestPendingAndCallContract(t *testing.T) {
10211020
testAddr := crypto.PubkeyToAddress(testKey.PublicKey)
10221021
sim := simTestBackend(testAddr)
@@ -1227,11 +1226,10 @@ func TestFork(t *testing.T) {
12271226
Example contract to test event emission:
12281227
12291228
pragma solidity >=0.7.0 <0.9.0;
1230-
1231-
contract Callable {
1232-
event Called();
1233-
function Call() public { emit Called(); }
1234-
}
1229+
contract Callable {
1230+
event Called();
1231+
function Call() public { emit Called(); }
1232+
}
12351233
*/
12361234
const callableAbi = "[{\"anonymous\":false,\"inputs\":[],\"name\":\"Called\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"Call\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
12371235

@@ -1249,7 +1247,6 @@ const callableBin = "6080604052348015600f57600080fd5b5060998061001e6000396000f3f
12491247
// 7. Mine two blocks to trigger a reorg.
12501248
// 8. Check that the event was removed.
12511249
// 9. Re-send the transaction and mine a block.
1252-
//
12531250
// 10. Check that the event was reborn.
12541251
func TestForkLogsReborn(t *testing.T) {
12551252
testAddr := crypto.PubkeyToAddress(testKey.PublicKey)

accounts/abi/reflect.go

+8-14
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,11 @@ import (
2828
// given type
2929
// e.g. turn
3030
// var fields []reflect.StructField
31-
//
32-
// fields = append(fields, reflect.StructField{
33-
// Name: "X",
34-
// Type: reflect.TypeOf(new(big.Int)),
35-
// Tag: reflect.StructTag("json:\"" + "x" + "\""),
36-
// }
37-
//
31+
// fields = append(fields, reflect.StructField{
32+
// Name: "X",
33+
// Type: reflect.TypeOf(new(big.Int)),
34+
// Tag: reflect.StructTag("json:\"" + "x" + "\""),
35+
// }
3836
// into
3937
// type TupleT struct { X *big.Int }
4038
func ConvertType(in interface{}, proto interface{}) interface{} {
@@ -173,14 +171,10 @@ func setStruct(dst, src reflect.Value) error {
173171

174172
// mapArgNamesToStructFields maps a slice of argument names to struct fields.
175173
// first round: for each Exportable field that contains a `abi:""` tag
176-
//
177-
// and this field name exists in the given argument name list, pair them together.
178-
//
174+
// and this field name exists in the given argument name list, pair them together.
179175
// second round: for each argument name that has not been already linked,
180-
//
181-
// find what variable is expected to be mapped into, if it exists and has not been
182-
// used, pair them.
183-
//
176+
// find what variable is expected to be mapped into, if it exists and has not been
177+
// used, pair them.
184178
// Note this function assumes the given value is a struct value.
185179
func mapArgNamesToStructFields(argNames []string, value reflect.Value) (map[string]string, error) {
186180
typ := value.Type()

accounts/accounts.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ type Backend interface {
178178
// safely used to calculate a signature from.
179179
//
180180
// The hash is calulcated as
181-
//
182-
// keccak256("\x19Ethereum Signed Message:\n"${message length}${message}).
181+
// keccak256("\x19Ethereum Signed Message:\n"${message length}${message}).
183182
//
184183
// This gives context to the signed message and prevents signing of transactions.
185184
func TextHash(data []byte) []byte {
@@ -191,8 +190,7 @@ func TextHash(data []byte) []byte {
191190
// safely used to calculate a signature from.
192191
//
193192
// The hash is calulcated as
194-
//
195-
// keccak256("\x19Ethereum Signed Message:\n"${message length}${message}).
193+
// keccak256("\x19Ethereum Signed Message:\n"${message length}${message}).
196194
//
197195
// This gives context to the signed message and prevents signing of transactions.
198196
func TextAndHash(data []byte) ([]byte, string) {

accounts/hd.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ var LegacyLedgerBaseDerivationPath = DerivationPath{0x80000000 + 44, 0x80000000
4646
// The BIP-32 spec https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
4747
// defines derivation paths to be of the form:
4848
//
49-
// m / purpose' / coin_type' / account' / change / address_index
49+
// m / purpose' / coin_type' / account' / change / address_index
5050
//
5151
// The BIP-44 spec https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki
5252
// defines that the `purpose` be 44' (or 0x8000002C) for crypto currencies, and

accounts/scwallet/wallet.go

-3
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,6 @@ func (s *Session) walletStatus() (*walletStatus, error) {
880880
}
881881

882882
// derivationPath fetches the wallet's current derivation path from the card.
883-
//
884883
//lint:ignore U1000 needs to be added to the console interface
885884
func (s *Session) derivationPath() (accounts.DerivationPath, error) {
886885
response, err := s.Channel.transmitEncrypted(claSCWallet, insStatus, statusP1Path, 0, nil)
@@ -996,15 +995,13 @@ func (s *Session) derive(path accounts.DerivationPath) (accounts.Account, error)
996995
}
997996

998997
// keyExport contains information on an exported keypair.
999-
//
1000998
//lint:ignore U1000 needs to be added to the console interface
1001999
type keyExport struct {
10021000
PublicKey []byte `asn1:"tag:0"`
10031001
PrivateKey []byte `asn1:"tag:1,optional"`
10041002
}
10051003

10061004
// publicKey returns the public key for the current derivation path.
1007-
//
10081005
//lint:ignore U1000 needs to be added to the console interface
10091006
func (s *Session) publicKey() ([]byte, error) {
10101007
response, err := s.Channel.transmitEncrypted(claSCWallet, insExportKey, exportP1Any, exportP2Pubkey, nil)

accounts/url.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@ func (u *URL) UnmarshalJSON(input []byte) error {
9292

9393
// Cmp compares x and y and returns:
9494
//
95-
// -1 if x < y
96-
// 0 if x == y
97-
// +1 if x > y
95+
// -1 if x < y
96+
// 0 if x == y
97+
// +1 if x > y
98+
//
9899
func (u URL) Cmp(url URL) int {
99100
if u.Scheme == url.Scheme {
100101
return strings.Compare(u.Path, url.Path)

0 commit comments

Comments
 (0)