aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm
diff options
context:
space:
mode:
authorSonic <sonic@dexon.org>2018-11-13 17:51:27 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:18 +0800
commit1df4ff9e24539a7a99c245fed3a47e8198f26de9 (patch)
tree4722e6f8db34d072795db3fdf943daa65f359eb3 /core/vm
parentb6549cddb95fe6357acd129e191a0944416593ed (diff)
downloadgo-tangerine-1df4ff9e24539a7a99c245fed3a47e8198f26de9.tar
go-tangerine-1df4ff9e24539a7a99c245fed3a47e8198f26de9.tar.gz
go-tangerine-1df4ff9e24539a7a99c245fed3a47e8198f26de9.tar.bz2
go-tangerine-1df4ff9e24539a7a99c245fed3a47e8198f26de9.tar.lz
go-tangerine-1df4ff9e24539a7a99c245fed3a47e8198f26de9.tar.xz
go-tangerine-1df4ff9e24539a7a99c245fed3a47e8198f26de9.tar.zst
go-tangerine-1df4ff9e24539a7a99c245fed3a47e8198f26de9.zip
core: push height of round 0 in genesis block (#17)
* core: push height of round 0 in genesis block * vm: fix governance dispatch method name mismatch with abi also rename RoundHeightLoc to roundHeightLoc
Diffstat (limited to 'core/vm')
-rw-r--r--core/vm/governance.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/core/vm/governance.go b/core/vm/governance.go
index cc453ace7..49141761f 100644
--- a/core/vm/governance.go
+++ b/core/vm/governance.go
@@ -917,7 +917,7 @@ func RunGovernanceContract(evm *EVM, input []byte, contract *Contract) (
return nil, errExecutionReverted
}
return res, nil
- case "RoundHeight":
+ case "roundHeight":
round := new(big.Int)
if err := method.Inputs.Unpack(&round, arguments); err != nil {
return nil, errExecutionReverted
@@ -939,7 +939,7 @@ func RunGovernanceContract(evm *EVM, input []byte, contract *Contract) (
// Storage position enums.
const (
- RoundHeightLoc = iota
+ roundHeightLoc = iota
nodesLoc
offsetLoc
crsLoc
@@ -1096,21 +1096,21 @@ func (s *GovernanceStateHelper) appendTo2DByteArray(pos, index *big.Int, data []
s.writeBytes(elementLoc, data)
}
-// uint256[] public RoundHeight;
+// uint256[] public roundHeight;
func (s *GovernanceStateHelper) LenRoundHeight() *big.Int {
- return s.getStateBigInt(big.NewInt(RoundHeightLoc))
+ return s.getStateBigInt(big.NewInt(roundHeightLoc))
}
func (s *GovernanceStateHelper) RoundHeight(round *big.Int) *big.Int {
- baseLoc := s.getSlotLoc(big.NewInt(RoundHeightLoc))
+ baseLoc := s.getSlotLoc(big.NewInt(roundHeightLoc))
loc := new(big.Int).Add(baseLoc, round)
return s.getStateBigInt(loc)
}
func (s *GovernanceStateHelper) PushRoundHeight(height *big.Int) {
// increase length by 1.
- length := s.getStateBigInt(big.NewInt(RoundHeightLoc))
- s.setStateBigInt(big.NewInt(RoundHeightLoc), new(big.Int).Add(length, big.NewInt(1)))
+ length := s.getStateBigInt(big.NewInt(roundHeightLoc))
+ s.setStateBigInt(big.NewInt(roundHeightLoc), new(big.Int).Add(length, big.NewInt(1)))
- baseLoc := s.getSlotLoc(big.NewInt(RoundHeightLoc))
+ baseLoc := s.getSlotLoc(big.NewInt(roundHeightLoc))
loc := new(big.Int).Add(baseLoc, length)
s.setStateBigInt(loc, height)