@@ -75,7 +75,7 @@ func (s *snapshot) Copy() *snapshot {
7575}
7676
7777// init initializes snapshot with the specified startup parameters.
78- func (s * snapshot ) init (api * ethapi.Backend , h * types.Header , state * state.StateDB , height uint64 ) error {
78+ func (s * snapshot ) init (api ethapi.Backend , h * types.Header , state * state.StateDB , height uint64 ) error {
7979 s .EpochStartHeight = height
8080 round , err := getRoundNumber (api , state , h )
8181 if err != nil {
@@ -219,7 +219,7 @@ func (c *DBFT) handleDKG(snapshot *snapshot, keystore *antimev.KeyStore, h *type
219219 // same network id and round number, then we should get the same result.
220220 // The result will be checked in epoch change, log an error message if no secret
221221 // can not be confirmed in committed PVSS.
222- _ , _ , err := keystore .DKGShare (( * c .backend ) .ChainConfig ().ChainID )
222+ _ , _ , err := keystore .DKGShare (c .backend .ChainConfig ().ChainID )
223223 if err != nil {
224224 return fmt .Errorf ("failed to replay sharing, err: %v" , err )
225225 }
@@ -278,7 +278,7 @@ func (c *DBFT) handleDKG(snapshot *snapshot, keystore *antimev.KeyStore, h *type
278278 // If is a member of pending consensus.
279279 indexOfSharing := slices .Index (snapshot .PendingCNs , amevAddress ) + 1
280280 if indexOfSharing > 0 {
281- err = taskList .taskShare (keystore , ( * c .backend ) .ChainConfig ().ChainID , receiverMessageKeys , zkVersion , currentHeight , recoverStartHeight )
281+ err = taskList .taskShare (keystore , c .backend .ChainConfig ().ChainID , receiverMessageKeys , zkVersion , currentHeight , recoverStartHeight )
282282 if err != nil {
283283 return fmt .Errorf ("failed to task DKG share, err: %v" , err )
284284 }
@@ -625,7 +625,7 @@ watchLoop:
625625 if newWatchList != nil && len (* newWatchList ) > 0 {
626626 watchTaskList = append (watchTaskList , * newWatchList ... )
627627 }
628- currentHeight := ( * c .backend ) .CurrentBlock ().Number .Uint64 ()
628+ currentHeight := c .backend .CurrentBlock ().Number .Uint64 ()
629629 log .Info ("DKG task watcher" , "currentHeight" , currentHeight , "watchListLength" , len (watchTaskList ))
630630
631631 // Loop tasks in watchTaskList.
@@ -846,7 +846,7 @@ func (t *taskList) taskReshareRecover(keystore *antimev.KeyStore, receiverMessag
846846}
847847
848848// getCurrentConsensus returns an address list of current CNs.
849- func getCurrentConsensus (backend * ethapi.Backend , state * state.StateDB , header * types.Header ) ([]common.Address , error ) {
849+ func getCurrentConsensus (backend ethapi.Backend , state * state.StateDB , header * types.Header ) ([]common.Address , error ) {
850850 var result []common.Address
851851 err := readFromContract (& result , backend , systemcontracts .GovernanceProxyHash , systemcontracts .GovernanceABI , state , header , "getCurrentConsensus" )
852852 if err != nil {
@@ -856,7 +856,7 @@ func getCurrentConsensus(backend *ethapi.Backend, state *state.StateDB, header *
856856}
857857
858858// getPendingConsensus returns an address list of pending CNs.
859- func getPendingConsensus (backend * ethapi.Backend , state * state.StateDB , header * types.Header ) ([]common.Address , error ) {
859+ func getPendingConsensus (backend ethapi.Backend , state * state.StateDB , header * types.Header ) ([]common.Address , error ) {
860860 var result []common.Address
861861 err := readFromContract (& result , backend , systemcontracts .GovernanceProxyHash , systemcontracts .GovernanceABI , state , header , "getPendingConsensus" )
862862 if err != nil {
@@ -866,7 +866,7 @@ func getPendingConsensus(backend *ethapi.Backend, state *state.StateDB, header *
866866}
867867
868868// getSharePeriodDuration returns a number of blocks as the duration of each sharing period.
869- func getSharePeriodDuration (backend * ethapi.Backend , state * state.StateDB , header * types.Header ) (uint64 , error ) {
869+ func getSharePeriodDuration (backend ethapi.Backend , state * state.StateDB , header * types.Header ) (uint64 , error ) {
870870 var result * big.Int
871871 err := readFromContract (& result , backend , systemcontracts .GovernanceProxyHash , systemcontracts .GovernanceABI , state , header , "sharePeriodDuration" )
872872 if err != nil {
@@ -876,7 +876,7 @@ func getSharePeriodDuration(backend *ethapi.Backend, state *state.StateDB, heade
876876}
877877
878878// getEpochDuration returns a number of blocks as the duration of each governanace epoch.
879- func getEpochDuration (backend * ethapi.Backend , state * state.StateDB , header * types.Header ) (uint64 , error ) {
879+ func getEpochDuration (backend ethapi.Backend , state * state.StateDB , header * types.Header ) (uint64 , error ) {
880880 var result * big.Int
881881 err := readFromContract (& result , backend , systemcontracts .GovernanceProxyHash , systemcontracts .GovernanceABI , state , header , "epochDuration" )
882882 if err != nil {
@@ -886,7 +886,7 @@ func getEpochDuration(backend *ethapi.Backend, state *state.StateDB, header *typ
886886}
887887
888888// getCurrentEpochStartHeight returns the block height when the current governanace epoch starts.
889- func getCurrentEpochStartHeight (backend * ethapi.Backend , state * state.StateDB , header * types.Header ) (uint64 , error ) {
889+ func getCurrentEpochStartHeight (backend ethapi.Backend , state * state.StateDB , header * types.Header ) (uint64 , error ) {
890890 var result * big.Int
891891 err := readFromContract (& result , backend , systemcontracts .GovernanceProxyHash , systemcontracts .GovernanceABI , state , header , "currentEpochStartHeight" )
892892 if err != nil {
@@ -896,7 +896,7 @@ func getCurrentEpochStartHeight(backend *ethapi.Backend, state *state.StateDB, h
896896}
897897
898898// getMessagePubkeys returns the message keys of input address list.
899- func getMessagePubkeys (backend * ethapi.Backend , addrs []common.Address , state * state.StateDB , header * types.Header ) ([]* ecies.PublicKey , error ) {
899+ func getMessagePubkeys (backend ethapi.Backend , addrs []common.Address , state * state.StateDB , header * types.Header ) ([]* ecies.PublicKey , error ) {
900900 result := make ([]* ecies.PublicKey , len (addrs ))
901901 for i , addr := range addrs {
902902 pub , err := getMessagePubkey (backend , addr , state , header )
@@ -909,7 +909,7 @@ func getMessagePubkeys(backend *ethapi.Backend, addrs []common.Address, state *s
909909}
910910
911911// getMessagePubkey returns the message key of input address.
912- func getMessagePubkey (backend * ethapi.Backend , addr common.Address , state * state.StateDB , header * types.Header ) (* ecies.PublicKey , error ) {
912+ func getMessagePubkey (backend ethapi.Backend , addr common.Address , state * state.StateDB , header * types.Header ) (* ecies.PublicKey , error ) {
913913 var result string
914914 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic , state , header , "messagePubkeys" , addr )
915915 if err != nil {
@@ -927,7 +927,7 @@ func getMessagePubkey(backend *ethapi.Backend, addr common.Address, state *state
927927}
928928
929929// getIndexCurrentNeedRecovering returns an array of DKG index that needs recover.
930- func getIndexCurrentNeedRecovering (backend * ethapi.Backend , state * state.StateDB , header * types.Header ) ([]uint64 , error ) {
930+ func getIndexCurrentNeedRecovering (backend ethapi.Backend , state * state.StateDB , header * types.Header ) ([]uint64 , error ) {
931931 var result []* big.Int
932932 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic , state , header , "indexCurrentNeedRecovering" )
933933 if err != nil {
@@ -941,7 +941,7 @@ func getIndexCurrentNeedRecovering(backend *ethapi.Backend, state *state.StateDB
941941}
942942
943943// isShareReady checks if the DKG sharing is 100% uploaded.
944- func isShareReady (backend * ethapi.Backend , state * state.StateDB , header * types.Header ) (bool , error ) {
944+ func isShareReady (backend ethapi.Backend , state * state.StateDB , header * types.Header ) (bool , error ) {
945945 var result bool
946946 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic , state , header , "isShareReady" )
947947 if err != nil {
@@ -951,7 +951,7 @@ func isShareReady(backend *ethapi.Backend, state *state.StateDB, header *types.H
951951}
952952
953953// getReshareMsgs gets the reshare messages from specific sender index and round.
954- func getReshareMsgs (backend * ethapi.Backend , round , index uint64 , state * state.StateDB , header * types.Header ) ([][]byte , error ) {
954+ func getReshareMsgs (backend ethapi.Backend , round , index uint64 , state * state.StateDB , header * types.Header ) ([][]byte , error ) {
955955 var result [][]byte
956956 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic ,
957957 state , header , "getReshareMsgs" , big .NewInt (int64 (round )), big .NewInt (int64 (index )))
@@ -962,7 +962,7 @@ func getReshareMsgs(backend *ethapi.Backend, round, index uint64, state *state.S
962962}
963963
964964// getResharePVSS gets the reshare PVSS from specific sender index and round.
965- func getResharePVSS (backend * ethapi.Backend , round , index uint64 , state * state.StateDB , header * types.Header ) ([]byte , error ) {
965+ func getResharePVSS (backend ethapi.Backend , round , index uint64 , state * state.StateDB , header * types.Header ) ([]byte , error ) {
966966 var result []byte
967967 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic ,
968968 state , header , "rpvsses" , big .NewInt (int64 (round )), big .NewInt (int64 (index )))
@@ -973,7 +973,7 @@ func getResharePVSS(backend *ethapi.Backend, round, index uint64, state *state.S
973973}
974974
975975// getShareMsgs gets the share messages from specific sender index and round.
976- func getShareMsgs (backend * ethapi.Backend , round , index uint64 , state * state.StateDB , header * types.Header ) ([][]byte , error ) {
976+ func getShareMsgs (backend ethapi.Backend , round , index uint64 , state * state.StateDB , header * types.Header ) ([][]byte , error ) {
977977 var result [][]byte
978978 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic ,
979979 state , header , "getShareMsgs" , big .NewInt (int64 (round )), big .NewInt (int64 (index )))
@@ -984,7 +984,7 @@ func getShareMsgs(backend *ethapi.Backend, round, index uint64, state *state.Sta
984984}
985985
986986// getSharePVSS gets the share PVSS from specific sender index and round.
987- func getSharePVSS (backend * ethapi.Backend , round , index uint64 , state * state.StateDB , header * types.Header ) ([]byte , error ) {
987+ func getSharePVSS (backend ethapi.Backend , round , index uint64 , state * state.StateDB , header * types.Header ) ([]byte , error ) {
988988 var result []byte
989989 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic ,
990990 state , header , "spvsses" , big .NewInt (int64 (round )), big .NewInt (int64 (index )))
@@ -995,7 +995,7 @@ func getSharePVSS(backend *ethapi.Backend, round, index uint64, state *state.Sta
995995}
996996
997997// getRecoverMsgs gets the recover messages from specific sender index and round, with a receiver index.
998- func getRecoverMsgs (backend * ethapi.Backend , round , senderIndex , arrIndex uint64 , state * state.StateDB , header * types.Header ) ([]byte , error ) {
998+ func getRecoverMsgs (backend ethapi.Backend , round , senderIndex , arrIndex uint64 , state * state.StateDB , header * types.Header ) ([]byte , error ) {
999999 var result []byte
10001000 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic ,
10011001 state , header , "recoverMsgs" , big .NewInt (int64 (round )), big .NewInt (int64 (senderIndex )), big .NewInt (int64 (arrIndex )))
@@ -1006,7 +1006,7 @@ func getRecoverMsgs(backend *ethapi.Backend, round, senderIndex, arrIndex uint64
10061006}
10071007
10081008// getAggregatedCommitment gets the global aggregated commitment after DKG share.
1009- func getAggregatedCommitment (backend * ethapi.Backend , round uint64 , state * state.StateDB , header * types.Header ) ([]byte , error ) {
1009+ func getAggregatedCommitment (backend ethapi.Backend , round uint64 , state * state.StateDB , header * types.Header ) ([]byte , error ) {
10101010 var result []byte
10111011 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic ,
10121012 state , header , "aggregatedCommitments" , big .NewInt (int64 (round )))
@@ -1017,7 +1017,7 @@ func getAggregatedCommitment(backend *ethapi.Backend, round uint64, state *state
10171017}
10181018
10191019// getRoundNumber gets the DKG round number.
1020- func getRoundNumber (backend * ethapi.Backend , state * state.StateDB , header * types.Header ) (uint64 , error ) {
1020+ func getRoundNumber (backend ethapi.Backend , state * state.StateDB , header * types.Header ) (uint64 , error ) {
10211021 var result * big.Int
10221022 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic ,
10231023 state , header , "roundNumber" )
@@ -1028,7 +1028,7 @@ func getRoundNumber(backend *ethapi.Backend, state *state.StateDB, header *types
10281028}
10291029
10301030// getZKVersion gets the DKG ZK version
1031- func getZKVersion (backend * ethapi.Backend , state * state.StateDB , header * types.Header ) (uint64 , error ) {
1031+ func getZKVersion (backend ethapi.Backend , state * state.StateDB , header * types.Header ) (uint64 , error ) {
10321032 var result * big.Int
10331033 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic ,
10341034 state , header , "ZK_VERSION" )
@@ -1043,7 +1043,7 @@ func getZKVersion(backend *ethapi.Backend, state *state.StateDB, header *types.H
10431043}
10441044
10451045// readFromContract calls a contract with ABI-packed inputs.
1046- func readFromContract (res interface {}, backend * ethapi.Backend , contract common.Address , contractAbi abi.ABI , state * state.StateDB , header * types.Header , method string , args ... interface {}) error {
1046+ func readFromContract (res interface {}, backend ethapi.Backend , contract common.Address , contractAbi abi.ABI , state * state.StateDB , header * types.Header , method string , args ... interface {}) error {
10471047 if backend == nil {
10481048 return errNotInitializedBackend
10491049 }
@@ -1062,7 +1062,7 @@ func readFromContract(res interface{}, backend *ethapi.Backend, contract common.
10621062 ctx , cancel := context .WithCancel (context .Background ())
10631063 // Cancel when we are finished consuming integers.
10641064 defer cancel ()
1065- result , err := ethapi .DoCallAtState (ctx , * backend , txArgs , state , header , nil , nil , 0 , 0 )
1065+ result , err := ethapi .DoCallAtState (ctx , backend , txArgs , state , header , nil , nil , 0 , 0 )
10661066 if err != nil {
10671067 return fmt .Errorf ("failed to call at state '%s': %v" , method , err )
10681068 }
0 commit comments