From d20f91057acb0d1ccb3b3a13a4543aae1781f240 Mon Sep 17 00:00:00 2001 From: wit liu <765765346@qq.com> Date: Wed, 24 Sep 2025 07:58:40 +0800 Subject: [PATCH] all: fix whitespace (#1572) --- XDCx/tradingstate/encoding.go | 1 - XDCxlending/lendingstate/lendingitem.go | 2 -- XDCxlending/lendingstate/settle_balance.go | 1 - consensus/XDPoS/api_test.go | 2 -- consensus/XDPoS/engines/engine_v2/engine.go | 2 -- consensus/XDPoS/engines/engine_v2/epochSwitch.go | 1 - consensus/XDPoS/engines/engine_v2/syncInfo.go | 1 - consensus/XDPoS/engines/engine_v2/utils.go | 1 - consensus/tests/engine_v1_tests/helper.go | 1 - core/blockchain.go | 1 - core/blockchain_test.go | 3 --- core/types/lending_transaction.go | 1 - core/types/order_signing.go | 1 - core/vm/privacy/bulletproof_test.go | 6 ------ ethdb/dbtest/testsuite.go | 1 - internal/ethapi/api.go | 1 - internal/jsre/pretty.go | 1 - p2p/rlpx.go | 1 - p2p/simulations/adapters/inproc.go | 1 - p2p/simulations/examples/ping-pong.go | 1 - p2p/simulations/network.go | 1 - 21 files changed, 31 deletions(-) diff --git a/XDCx/tradingstate/encoding.go b/XDCx/tradingstate/encoding.go index 13f0197c85..1e95c74e03 100644 --- a/XDCx/tradingstate/encoding.go +++ b/XDCx/tradingstate/encoding.go @@ -10,5 +10,4 @@ func EncodeBytesItem(val interface{}) ([]byte, error) { func DecodeBytesItem(bytes []byte, val interface{}) error { return rlp.DecodeBytes(bytes, val) - } diff --git a/XDCxlending/lendingstate/lendingitem.go b/XDCxlending/lendingstate/lendingitem.go index c1dc624158..c2c9adb315 100644 --- a/XDCxlending/lendingstate/lendingitem.go +++ b/XDCxlending/lendingstate/lendingitem.go @@ -396,7 +396,6 @@ func VerifyBalance(isXDCXLendingFork bool, statedb *state.StateDB, lendingStateD return fmt.Errorf("VerifyBalance: not enough balance to process payment for lendingTrade."+ "lendingTradeId: %v. Token: %s. ExpectedBalance: %s. ActualBalance: %s", lendingTradeId, lendingTrade.LendingToken.Hex(), paymentBalance.String(), tokenBalance.String()) - } case Market, Limit: switch side { @@ -421,7 +420,6 @@ func VerifyBalance(isXDCXLendingFork bool, statedb *state.StateDB, lendingStateD if defaultFeeInXDC.Cmp(common.RelayerLendingFee) <= 0 { return ErrQuantityTradeTooSmall } - } case LendingStatusCancelled: diff --git a/XDCxlending/lendingstate/settle_balance.go b/XDCxlending/lendingstate/settle_balance.go index b3e70a56dc..d2aa62ab9a 100644 --- a/XDCxlending/lendingstate/settle_balance.go +++ b/XDCxlending/lendingstate/settle_balance.go @@ -159,7 +159,6 @@ func GetSettleBalance(isXDCXLendingFork bool, } } } else { - collateralQuantity := new(big.Int).Mul(quantityToLend, collateralTokenDecimal) collateralQuantity = new(big.Int).Mul(collateralQuantity, depositRate) // eg: depositRate = 150% collateralQuantity = new(big.Int).Div(collateralQuantity, big.NewInt(100)) diff --git a/consensus/XDPoS/api_test.go b/consensus/XDPoS/api_test.go index 923726c010..2bff765d4e 100644 --- a/consensus/XDPoS/api_test.go +++ b/consensus/XDPoS/api_test.go @@ -11,7 +11,6 @@ import ( ) func TestCalculateSignersVote(t *testing.T) { - info := make(map[string]SignerTypes) votes := utils.NewPool() masternodes := []common.Address{{1}, {2}, {3}} @@ -46,7 +45,6 @@ func TestCalculateSignersVote(t *testing.T) { } func TestCalculateSignersTimeout(t *testing.T) { - info := make(map[string]SignerTypes) timeouts := utils.NewPool() masternodes := []common.Address{{1}, {2}, {3}} diff --git a/consensus/XDPoS/engines/engine_v2/engine.go b/consensus/XDPoS/engines/engine_v2/engine.go index c223d406d4..3bd54688b9 100644 --- a/consensus/XDPoS/engines/engine_v2/engine.go +++ b/consensus/XDPoS/engines/engine_v2/engine.go @@ -211,7 +211,6 @@ func (x *XDPoS_v2) initial(chain consensus.ChainReader, header *types.Header) er // can not call processQC because round is equal to default x.currentRound = 1 x.highestQuorumCert = quorumCert - } else { log.Info("[initial] highest QC from current header") quorumCert, _, _, err = x.getExtraFields(header) @@ -306,7 +305,6 @@ func (x *XDPoS_v2) YourTurn(chain consensus.ChainReader, parent *types.Header, s // Prepare implements consensus.Engine, preparing all the consensus fields of the // header for running the transactions on top. func (x *XDPoS_v2) Prepare(chain consensus.ChainReader, header *types.Header) error { - x.lock.RLock() currentRound := x.currentRound highestQC := x.highestQuorumCert diff --git a/consensus/XDPoS/engines/engine_v2/epochSwitch.go b/consensus/XDPoS/engines/engine_v2/epochSwitch.go index 5f9892e985..a2ae67d59a 100644 --- a/consensus/XDPoS/engines/engine_v2/epochSwitch.go +++ b/consensus/XDPoS/engines/engine_v2/epochSwitch.go @@ -209,7 +209,6 @@ func (x *XDPoS_v2) GetEpochSwitchInfoBetween(chain consensus.ChainReader, begin, if iteratorNum.Cmp(begin.Number) >= 0 { infos = append(infos, epochSwitchInfo) } - } // reverse the array for i := 0; i < len(infos)/2; i++ { diff --git a/consensus/XDPoS/engines/engine_v2/syncInfo.go b/consensus/XDPoS/engines/engine_v2/syncInfo.go index f8138550eb..b007379376 100644 --- a/consensus/XDPoS/engines/engine_v2/syncInfo.go +++ b/consensus/XDPoS/engines/engine_v2/syncInfo.go @@ -127,7 +127,6 @@ func (x *XDPoS_v2) processSyncInfoPool(chain consensus.ChainReader) { } func (x *XDPoS_v2) verifySignatures(messageHash common.Hash, signatures []types.Signature, candidates []common.Address) error { - var wg sync.WaitGroup wg.Add(len(signatures)) var haveError error diff --git a/consensus/XDPoS/engines/engine_v2/utils.go b/consensus/XDPoS/engines/engine_v2/utils.go index d8003aa920..56f828f3f3 100644 --- a/consensus/XDPoS/engines/engine_v2/utils.go +++ b/consensus/XDPoS/engines/engine_v2/utils.go @@ -63,7 +63,6 @@ func ecrecover(header *types.Header, sigcache *utils.SigLRU) (common.Address, er sigcache.Add(hash, signer) return signer, nil - } // Get masternodes address from checkpoint Header. Only used for v1 last block diff --git a/consensus/tests/engine_v1_tests/helper.go b/consensus/tests/engine_v1_tests/helper.go index 74df639d33..e21dd5b6ad 100644 --- a/consensus/tests/engine_v1_tests/helper.go +++ b/consensus/tests/engine_v1_tests/helper.go @@ -72,7 +72,6 @@ func RandStringBytes(n int) string { } func getCommonBackend(t *testing.T, chainConfig *params.ChainConfig) *backends.SimulatedBackend { - // initial helper backend contractBackendForSC := backends.NewXDCSimulatedBackend(types.GenesisAlloc{ voterAddr: {Balance: new(big.Int).SetUint64(10000000000)}, diff --git a/core/blockchain.go b/core/blockchain.go index a1fbc24280..c2c42b4b98 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -2917,7 +2917,6 @@ func (bc *BlockChain) logLendingData(block *types.Block) { }() for _, batch := range batches { - dirtyOrderCount := uint64(0) for _, item := range batch.Data { var ( diff --git a/core/blockchain_test.go b/core/blockchain_test.go index ff15201ef9..707633579a 100644 --- a/core/blockchain_test.go +++ b/core/blockchain_test.go @@ -873,7 +873,6 @@ func TestChainTxReorgs(t *testing.T) { } func TestLogReorgs(t *testing.T) { - var ( key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291") addr1 = crypto.PubkeyToAddress(key1.PublicKey) @@ -1436,7 +1435,6 @@ func benchmarkLargeNumberOfValueToNonexisting(b *testing.B, numTxs, numBlocks in b.StopTimer() if got := chain.CurrentBlock().Transactions().Len(); got != numTxs*numBlocks { b.Fatalf("Transactions were not included, expected %d, got %d", (numTxs * numBlocks), got) - } } } @@ -1577,7 +1575,6 @@ func TestAreTwoBlocksSamePath(t *testing.T) { t.Error("Failed") } }) - } // TestEIP2718Transition tests that an EIP-2718 transaction will be accepted diff --git a/core/types/lending_transaction.go b/core/types/lending_transaction.go index be7329037b..61e93906ba 100644 --- a/core/types/lending_transaction.go +++ b/core/types/lending_transaction.go @@ -214,7 +214,6 @@ func (tx *LendingTransaction) WithSignature(signer LendingSigner, sig []byte) (* // ImportSignature make lending tx with specific signature func (tx *LendingTransaction) ImportSignature(V, R, S *big.Int) *LendingTransaction { - if V != nil { tx.data.V = V } diff --git a/core/types/order_signing.go b/core/types/order_signing.go index 8fa5625529..c03f4dc141 100644 --- a/core/types/order_signing.go +++ b/core/types/order_signing.go @@ -172,7 +172,6 @@ func MarshalSignature(R, S, V *big.Int) ([]byte, error) { // Sender get signer from func (ordersign OrderTxSigner) Sender(tx *OrderTransaction) (common.Address, error) { - message := crypto.Keccak256( []byte("\x19Ethereum Signed Message:\n32"), ordersign.Hash(tx).Bytes(), diff --git a/core/vm/privacy/bulletproof_test.go b/core/vm/privacy/bulletproof_test.go index 223ad77150..5d022e5e08 100644 --- a/core/vm/privacy/bulletproof_test.go +++ b/core/vm/privacy/bulletproof_test.go @@ -281,11 +281,9 @@ func TestInnerProductVerifyFastLen64Rand(t *testing.T) { t.Error("Inner Product Proof incorrect") fmt.Printf("Values Used: \n\ta = %s\n\tb = %s\n", a, b) } - } func TestMRPProveZERO(t *testing.T) { - mRangeProof, _ := MRPProve([]*big.Int{ new(big.Int).SetInt64(0), }) @@ -294,7 +292,6 @@ func TestMRPProveZERO(t *testing.T) { } func TestMRPProve_MAX_2_POW_64(t *testing.T) { - mRangeProof, _ := MRPProve([]*big.Int{ new(big.Int).SetUint64(0xFFFFFFFFFFFFFFFF), }) @@ -303,7 +300,6 @@ func TestMRPProve_MAX_2_POW_64(t *testing.T) { } func TestMRPProveOutOfSupportedRange(t *testing.T) { - value, _ := new(big.Int).SetString("FFFFFFFFFFFFFFFFFFFF", 16) _, err := MRPProve([]*big.Int{ value, @@ -312,7 +308,6 @@ func TestMRPProveOutOfSupportedRange(t *testing.T) { } func TestMRPProve_RANDOM(t *testing.T) { - mRangeProof, _ := MRPProve(Rand64Vector(1)) mv := MRPVerify(&mRangeProof) assert.Equal(t, mv, true, " MRProof incorrect") @@ -343,7 +338,6 @@ func Rand64Vector(l int) []*big.Int { } func TestMRPProveValueNumberNotSupported(t *testing.T) { - _, err := MRPProve(Rand64Vector(3)) assert.NotNil(t, err, "MRProof incorrect - accepted 3 inputs") diff --git a/ethdb/dbtest/testsuite.go b/ethdb/dbtest/testsuite.go index 839427ae5e..72549d0fc6 100644 --- a/ethdb/dbtest/testsuite.go +++ b/ethdb/dbtest/testsuite.go @@ -312,7 +312,6 @@ func TestDatabaseSuite(t *testing.T, New func() ethdb.KeyValueStore) { t.Errorf("got: %s; want: %s", got, want) } }) - } func iterateKeys(it ethdb.Iterator) []string { diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index e78e2f21cc..289061063c 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -2071,7 +2071,6 @@ func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (c // SubmitTransaction is a helper function that submits tx to txPool and logs a message. func submitOrderTransaction(ctx context.Context, b Backend, tx *types.OrderTransaction) (common.Hash, error) { - if err := b.SendOrderTx(ctx, tx); err != nil { return common.Hash{}, err } diff --git a/internal/jsre/pretty.go b/internal/jsre/pretty.go index 4171e00906..bd772b4927 100644 --- a/internal/jsre/pretty.go +++ b/internal/jsre/pretty.go @@ -219,7 +219,6 @@ func (ctx ppctx) fields(obj *goja.Object) []string { vals = append(vals, k) } } - } iterOwnAndConstructorKeys(ctx.vm, obj, add) sort.Strings(vals) diff --git a/p2p/rlpx.go b/p2p/rlpx.go index bf966fe2ff..3cfb62007b 100644 --- a/p2p/rlpx.go +++ b/p2p/rlpx.go @@ -121,7 +121,6 @@ func (t *rlpx) close(err error) { } func (t *rlpx) doProtoHandshake(our *protoHandshake) (their *protoHandshake, err error) { - // Writing our handshake happens concurrently, we prefer // returning the handshake read error. If the remote side // disconnects us early with a valid reason, we should return it diff --git a/p2p/simulations/adapters/inproc.go b/p2p/simulations/adapters/inproc.go index cf9c67d683..1867b20fe7 100644 --- a/p2p/simulations/adapters/inproc.go +++ b/p2p/simulations/adapters/inproc.go @@ -240,7 +240,6 @@ func (sn *SimNode) Start(snapshots map[string][]byte) error { serviceFunc := sn.adapter.lifecycles[name] service, err := serviceFunc(ctx, sn.node) if err != nil { - regErr = err return } diff --git a/p2p/simulations/examples/ping-pong.go b/p2p/simulations/examples/ping-pong.go index 8c7f8b505b..422a653cf9 100644 --- a/p2p/simulations/examples/ping-pong.go +++ b/p2p/simulations/examples/ping-pong.go @@ -57,7 +57,6 @@ func main() { var adapter adapters.NodeAdapter switch *adapterType { - case "sim": log.Info("using sim adapter") adapter = adapters.NewSimAdapter(services) diff --git a/p2p/simulations/network.go b/p2p/simulations/network.go index 0addd33262..cbfb5e9ecb 100644 --- a/p2p/simulations/network.go +++ b/p2p/simulations/network.go @@ -234,7 +234,6 @@ func (net *Network) watchPeerEvents(id discover.NodeID, events chan *p2p.PeerEve } peer := event.Peer switch event.Type { - case p2p.PeerEventTypeAdd: net.DidConnect(id, peer)