diff options
author | Wei-Ning Huang <w@dexon.org> | 2019-03-19 02:31:16 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 21:32:58 +0800 |
commit | fa793b8d7eeb3601c9b028544f2033228aa95b33 (patch) | |
tree | eba0f6e741daed268209a8cf65e55e447ef4184d | |
parent | 0913656f3dd8cb53661923fd33f14a0a25befb71 (diff) | |
download | dexon-fa793b8d7eeb3601c9b028544f2033228aa95b33.tar.gz dexon-fa793b8d7eeb3601c9b028544f2033228aa95b33.tar.zst dexon-fa793b8d7eeb3601c9b028544f2033228aa95b33.zip |
core: vm: fix naming consistency
-rw-r--r-- | core/vm/oracle_contracts.go | 18 | ||||
-rw-r--r-- | core/vm/oracle_contracts_test.go | 4 |
2 files changed, 11 insertions, 11 deletions
diff --git a/core/vm/oracle_contracts.go b/core/vm/oracle_contracts.go index e58133990..a1ac8ed7b 100644 --- a/core/vm/oracle_contracts.go +++ b/core/vm/oracle_contracts.go @@ -615,7 +615,7 @@ func (s *GovernanceState) ClearDKGComplaints() { s.erase1DByteArray(big.NewInt(dkgComplaintsLoc)) } -// mapping(address => bool) public dkgReady; +// mapping(address => bool) public dkgMPKReadys; func (s *GovernanceState) DKGMPKReady(addr common.Address) bool { mapLoc := s.getMapLoc(big.NewInt(dkgReadyLoc), addr.Bytes()) return s.getStateBigInt(mapLoc).Cmp(big.NewInt(0)) != 0 @@ -628,13 +628,13 @@ func (s *GovernanceState) PutDKGMPKReady(addr common.Address, ready bool) { } s.setStateBigInt(mapLoc, res) } -func (s *GovernanceState) ClearDKGMPKReady(dkgSet map[coreTypes.NodeID]struct{}) { +func (s *GovernanceState) ClearDKGMPKReadys(dkgSet map[coreTypes.NodeID]struct{}) { for id := range dkgSet { s.PutDKGMPKReady(IdToAddress(id), false) } } -// uint256 public dkgReadysCount; +// uint256 public dkgMPKReadysCount; func (s *GovernanceState) DKGMPKReadysCount() *big.Int { return s.getStateBigInt(big.NewInt(dkgReadysCountLoc)) } @@ -646,7 +646,7 @@ func (s *GovernanceState) ResetDKGMPKReadysCount() { s.setStateBigInt(big.NewInt(dkgReadysCountLoc), big.NewInt(0)) } -// mapping(address => bool) public dkgFinalized; +// mapping(address => bool) public dkgFinalizeds; func (s *GovernanceState) DKGFinalized(addr common.Address) bool { mapLoc := s.getMapLoc(big.NewInt(dkgFinalizedLoc), addr.Bytes()) return s.getStateBigInt(mapLoc).Cmp(big.NewInt(0)) != 0 @@ -659,7 +659,7 @@ func (s *GovernanceState) PutDKGFinalized(addr common.Address, finalized bool) { } s.setStateBigInt(mapLoc, res) } -func (s *GovernanceState) ClearDKGFinalized(dkgSet map[coreTypes.NodeID]struct{}) { +func (s *GovernanceState) ClearDKGFinalizeds(dkgSet map[coreTypes.NodeID]struct{}) { for id := range dkgSet { s.PutDKGFinalized(IdToAddress(id), false) } @@ -1203,9 +1203,9 @@ func (g *GovernanceContract) clearDKG() { dkgSet := g.getDKGSet(g.evm.Round) g.state.ClearDKGMasterPublicKeys() g.state.ClearDKGComplaints() - g.state.ClearDKGMPKReady(dkgSet) + g.state.ClearDKGMPKReadys(dkgSet) g.state.ResetDKGMPKReadysCount() - g.state.ClearDKGFinalized(dkgSet) + g.state.ClearDKGFinalizeds(dkgSet) g.state.ResetDKGFinalizedsCount() } @@ -2041,7 +2041,7 @@ func (g *GovernanceContract) Run(evm *EVM, input []byte, contract *Contract) (re return nil, errExecutionReverted } return res, nil - case "dkgReadys": + case "dkgMPKReadys": addr := common.Address{} if err := method.Inputs.Unpack(&addr, arguments); err != nil { return nil, errExecutionReverted @@ -2052,7 +2052,7 @@ func (g *GovernanceContract) Run(evm *EVM, input []byte, contract *Contract) (re return nil, errExecutionReverted } return res, nil - case "dkgReadysCount": + case "dkgMPKReadysCount": count := g.state.DKGMPKReadysCount() res, err := method.Outputs.Pack(count) if err != nil { diff --git a/core/vm/oracle_contracts_test.go b/core/vm/oracle_contracts_test.go index 6e2a7fc7f..16d8e8a92 100644 --- a/core/vm/oracle_contracts_test.go +++ b/core/vm/oracle_contracts_test.go @@ -910,9 +910,9 @@ func (g *OracleContractsTestSuite) TestResetDKG() { dkgSet := dkgSets[round-1] g.s.ClearDKGMasterPublicKeys() g.s.ClearDKGComplaints() - g.s.ClearDKGMPKReady(dkgSet) + g.s.ClearDKGMPKReadys(dkgSet) g.s.ResetDKGMPKReadysCount() - g.s.ClearDKGFinalized(dkgSet) + g.s.ClearDKGFinalizeds(dkgSet) g.s.ResetDKGFinalizedsCount() g.s.SetDKGRound(big.NewInt(int64(round))) } |