@@ -74,7 +74,7 @@ func (s *snapshot) Copy() *snapshot {
7474}
7575
7676// init initializes snapshot with the specified startup parameters.
77- func (s * snapshot ) init (api * ethapi.Backend , h * types.Header , state * state.StateDB , height uint64 ) error {
77+ func (s * snapshot ) init (api ethapi.Backend , h * types.Header , state * state.StateDB , height uint64 ) error {
7878 s .EpochStartHeight = height
7979 round , err := getRoundNumber (api , state , h )
8080 if err != nil {
@@ -555,7 +555,7 @@ func (c *DBFT) loopWatchTaskList() {
555555
556556 var watchTaskList []* task
557557 for range c .loopWatchTaskChan {
558- currentHeight := ( * c .backend ) .CurrentBlock ().Number .Uint64 ()
558+ currentHeight := c .backend .CurrentBlock ().Number .Uint64 ()
559559 if len (c .appendWatchTaskChan ) > 0 {
560560 // Append watchList from appendWatchTaskChan to watchTaskList.
561561 newWatchList := <- c .appendWatchTaskChan
@@ -773,7 +773,7 @@ func (t *taskList) taskReshareRecover(keystore *antimev.KeyStore, receiverMessag
773773}
774774
775775// getCurrentConsensus returns an address list of current CNs.
776- func getCurrentConsensus (backend * ethapi.Backend , state * state.StateDB , header * types.Header ) ([]common.Address , error ) {
776+ func getCurrentConsensus (backend ethapi.Backend , state * state.StateDB , header * types.Header ) ([]common.Address , error ) {
777777 var result []common.Address
778778 err := readFromContract (& result , backend , systemcontracts .GovernanceProxyHash , systemcontracts .GovernanceABI , state , header , "getCurrentConsensus" )
779779 if err != nil {
@@ -783,7 +783,7 @@ func getCurrentConsensus(backend *ethapi.Backend, state *state.StateDB, header *
783783}
784784
785785// getPendingConsensus returns an address list of pending CNs.
786- func getPendingConsensus (backend * ethapi.Backend , state * state.StateDB , header * types.Header ) ([]common.Address , error ) {
786+ func getPendingConsensus (backend ethapi.Backend , state * state.StateDB , header * types.Header ) ([]common.Address , error ) {
787787 var result []common.Address
788788 err := readFromContract (& result , backend , systemcontracts .GovernanceProxyHash , systemcontracts .GovernanceABI , state , header , "getPendingConsensus" )
789789 if err != nil {
@@ -793,7 +793,7 @@ func getPendingConsensus(backend *ethapi.Backend, state *state.StateDB, header *
793793}
794794
795795// getSharePeriodDuration returns a number of blocks as the duration of each sharing period.
796- func getSharePeriodDuration (backend * ethapi.Backend , state * state.StateDB , header * types.Header ) (uint64 , error ) {
796+ func getSharePeriodDuration (backend ethapi.Backend , state * state.StateDB , header * types.Header ) (uint64 , error ) {
797797 var result * big.Int
798798 err := readFromContract (& result , backend , systemcontracts .GovernanceProxyHash , systemcontracts .GovernanceABI , state , header , "sharePeriodDuration" )
799799 if err != nil {
@@ -803,7 +803,7 @@ func getSharePeriodDuration(backend *ethapi.Backend, state *state.StateDB, heade
803803}
804804
805805// getEpochDuration returns a number of blocks as the duration of each governanace epoch.
806- func getEpochDuration (backend * ethapi.Backend , state * state.StateDB , header * types.Header ) (uint64 , error ) {
806+ func getEpochDuration (backend ethapi.Backend , state * state.StateDB , header * types.Header ) (uint64 , error ) {
807807 var result * big.Int
808808 err := readFromContract (& result , backend , systemcontracts .GovernanceProxyHash , systemcontracts .GovernanceABI , state , header , "epochDuration" )
809809 if err != nil {
@@ -813,7 +813,7 @@ func getEpochDuration(backend *ethapi.Backend, state *state.StateDB, header *typ
813813}
814814
815815// getCurrentEpochStartHeight returns the block height when the current governanace epoch starts.
816- func getCurrentEpochStartHeight (backend * ethapi.Backend , state * state.StateDB , header * types.Header ) (uint64 , error ) {
816+ func getCurrentEpochStartHeight (backend ethapi.Backend , state * state.StateDB , header * types.Header ) (uint64 , error ) {
817817 var result * big.Int
818818 err := readFromContract (& result , backend , systemcontracts .GovernanceProxyHash , systemcontracts .GovernanceABI , state , header , "currentEpochStartHeight" )
819819 if err != nil {
@@ -823,7 +823,7 @@ func getCurrentEpochStartHeight(backend *ethapi.Backend, state *state.StateDB, h
823823}
824824
825825// getMessagePubkeys returns the message keys of input address list.
826- func getMessagePubkeys (backend * ethapi.Backend , addrs []common.Address , state * state.StateDB , header * types.Header ) ([]* ecies.PublicKey , error ) {
826+ func getMessagePubkeys (backend ethapi.Backend , addrs []common.Address , state * state.StateDB , header * types.Header ) ([]* ecies.PublicKey , error ) {
827827 result := make ([]* ecies.PublicKey , len (addrs ))
828828 for i , addr := range addrs {
829829 pub , err := getMessagePubkey (backend , addr , state , header )
@@ -836,7 +836,7 @@ func getMessagePubkeys(backend *ethapi.Backend, addrs []common.Address, state *s
836836}
837837
838838// getMessagePubkey returns the message key of input address.
839- func getMessagePubkey (backend * ethapi.Backend , addr common.Address , state * state.StateDB , header * types.Header ) (* ecies.PublicKey , error ) {
839+ func getMessagePubkey (backend ethapi.Backend , addr common.Address , state * state.StateDB , header * types.Header ) (* ecies.PublicKey , error ) {
840840 var result string
841841 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic , state , header , "messagePubkeys" , addr )
842842 if err != nil {
@@ -854,7 +854,7 @@ func getMessagePubkey(backend *ethapi.Backend, addr common.Address, state *state
854854}
855855
856856// getIndexCurrentNeedRecovering returns an array of DKG index that needs recover.
857- func getIndexCurrentNeedRecovering (backend * ethapi.Backend , state * state.StateDB , header * types.Header ) ([]uint64 , error ) {
857+ func getIndexCurrentNeedRecovering (backend ethapi.Backend , state * state.StateDB , header * types.Header ) ([]uint64 , error ) {
858858 var result []* big.Int
859859 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic , state , header , "indexCurrentNeedRecovering" )
860860 if err != nil {
@@ -868,7 +868,7 @@ func getIndexCurrentNeedRecovering(backend *ethapi.Backend, state *state.StateDB
868868}
869869
870870// isShareReady checks if the DKG sharing is 100% uploaded.
871- func isShareReady (backend * ethapi.Backend , state * state.StateDB , header * types.Header ) (bool , error ) {
871+ func isShareReady (backend ethapi.Backend , state * state.StateDB , header * types.Header ) (bool , error ) {
872872 var result bool
873873 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic , state , header , "isShareReady" )
874874 if err != nil {
@@ -878,7 +878,7 @@ func isShareReady(backend *ethapi.Backend, state *state.StateDB, header *types.H
878878}
879879
880880// getReshareMsgs gets the reshare messages from specific sender index and round.
881- func getReshareMsgs (backend * ethapi.Backend , round , index uint64 , state * state.StateDB , header * types.Header ) ([][]byte , error ) {
881+ func getReshareMsgs (backend ethapi.Backend , round , index uint64 , state * state.StateDB , header * types.Header ) ([][]byte , error ) {
882882 var result [][]byte
883883 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic ,
884884 state , header , "getReshareMsgs" , big .NewInt (int64 (round )), big .NewInt (int64 (index )))
@@ -889,7 +889,7 @@ func getReshareMsgs(backend *ethapi.Backend, round, index uint64, state *state.S
889889}
890890
891891// getResharePVSS gets the reshare PVSS from specific sender index and round.
892- func getResharePVSS (backend * ethapi.Backend , round , index uint64 , state * state.StateDB , header * types.Header ) ([]byte , error ) {
892+ func getResharePVSS (backend ethapi.Backend , round , index uint64 , state * state.StateDB , header * types.Header ) ([]byte , error ) {
893893 var result []byte
894894 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic ,
895895 state , header , "rpvsses" , big .NewInt (int64 (round )), big .NewInt (int64 (index )))
@@ -900,7 +900,7 @@ func getResharePVSS(backend *ethapi.Backend, round, index uint64, state *state.S
900900}
901901
902902// getShareMsgs gets the share messages from specific sender index and round.
903- func getShareMsgs (backend * ethapi.Backend , round , index uint64 , state * state.StateDB , header * types.Header ) ([][]byte , error ) {
903+ func getShareMsgs (backend ethapi.Backend , round , index uint64 , state * state.StateDB , header * types.Header ) ([][]byte , error ) {
904904 var result [][]byte
905905 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic ,
906906 state , header , "getShareMsgs" , big .NewInt (int64 (round )), big .NewInt (int64 (index )))
@@ -911,7 +911,7 @@ func getShareMsgs(backend *ethapi.Backend, round, index uint64, state *state.Sta
911911}
912912
913913// getSharePVSS gets the share PVSS from specific sender index and round.
914- func getSharePVSS (backend * ethapi.Backend , round , index uint64 , state * state.StateDB , header * types.Header ) ([]byte , error ) {
914+ func getSharePVSS (backend ethapi.Backend , round , index uint64 , state * state.StateDB , header * types.Header ) ([]byte , error ) {
915915 var result []byte
916916 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic ,
917917 state , header , "spvsses" , big .NewInt (int64 (round )), big .NewInt (int64 (index )))
@@ -922,7 +922,7 @@ func getSharePVSS(backend *ethapi.Backend, round, index uint64, state *state.Sta
922922}
923923
924924// getRecoverMsgs gets the recover messages from specific sender index and round, with a receiver index.
925- func getRecoverMsgs (backend * ethapi.Backend , round , senderIndex , arrIndex uint64 , state * state.StateDB , header * types.Header ) ([]byte , error ) {
925+ func getRecoverMsgs (backend ethapi.Backend , round , senderIndex , arrIndex uint64 , state * state.StateDB , header * types.Header ) ([]byte , error ) {
926926 var result []byte
927927 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic ,
928928 state , header , "recoverMsgs" , big .NewInt (int64 (round )), big .NewInt (int64 (senderIndex )), big .NewInt (int64 (arrIndex )))
@@ -933,7 +933,7 @@ func getRecoverMsgs(backend *ethapi.Backend, round, senderIndex, arrIndex uint64
933933}
934934
935935// getAggregatedCommitment gets the global aggregated commitment after DKG share.
936- func getAggregatedCommitment (backend * ethapi.Backend , round uint64 , state * state.StateDB , header * types.Header ) ([]byte , error ) {
936+ func getAggregatedCommitment (backend ethapi.Backend , round uint64 , state * state.StateDB , header * types.Header ) ([]byte , error ) {
937937 var result []byte
938938 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic ,
939939 state , header , "aggregatedCommitments" , big .NewInt (int64 (round )))
@@ -944,7 +944,7 @@ func getAggregatedCommitment(backend *ethapi.Backend, round uint64, state *state
944944}
945945
946946// getRoundNumber gets the DKG round number.
947- func getRoundNumber (backend * ethapi.Backend , state * state.StateDB , header * types.Header ) (uint64 , error ) {
947+ func getRoundNumber (backend ethapi.Backend , state * state.StateDB , header * types.Header ) (uint64 , error ) {
948948 var result * big.Int
949949 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic ,
950950 state , header , "roundNumber" )
@@ -955,7 +955,7 @@ func getRoundNumber(backend *ethapi.Backend, state *state.StateDB, header *types
955955}
956956
957957// getZKVersion gets the DKG ZK version
958- func getZKVersion (backend * ethapi.Backend , state * state.StateDB , header * types.Header ) (uint64 , error ) {
958+ func getZKVersion (backend ethapi.Backend , state * state.StateDB , header * types.Header ) (uint64 , error ) {
959959 var result * big.Int
960960 err := readFromContract (& result , backend , systemcontracts .KeyManagementProxyHash , systemcontracts .KeyManagementABIBasic ,
961961 state , header , "ZK_VERSION" )
@@ -966,7 +966,7 @@ func getZKVersion(backend *ethapi.Backend, state *state.StateDB, header *types.H
966966}
967967
968968// readFromContract calls a contract with ABI-packed inputs.
969- func readFromContract (res interface {}, backend * ethapi.Backend , contract common.Address , contractAbi abi.ABI , state * state.StateDB , header * types.Header , method string , args ... interface {}) error {
969+ func readFromContract (res interface {}, backend ethapi.Backend , contract common.Address , contractAbi abi.ABI , state * state.StateDB , header * types.Header , method string , args ... interface {}) error {
970970 if backend == nil {
971971 return errNotInitializedBackend
972972 }
@@ -985,7 +985,7 @@ func readFromContract(res interface{}, backend *ethapi.Backend, contract common.
985985 ctx , cancel := context .WithCancel (context .Background ())
986986 // Cancel when we are finished consuming integers.
987987 defer cancel ()
988- result , err := ethapi .DoCallAtState (ctx , * backend , txArgs , state , header , nil , nil , 0 , 0 )
988+ result , err := ethapi .DoCallAtState (ctx , backend , txArgs , state , header , nil , nil , 0 , 0 )
989989 if err != nil {
990990 return fmt .Errorf ("failed to call at state '%s': %v" , method , err )
991991 }
0 commit comments