mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 03:10:48 +00:00
modify logic to adapt new readers
This commit is contained in:
parent
4b1f635636
commit
8a456132e5
3 changed files with 8 additions and 8 deletions
|
|
@ -20,7 +20,7 @@ var (
|
||||||
ParsedBlockSignerABI, _ = abi.JSON(strings.NewReader(blockSignerContract.BlockSignerABI))
|
ParsedBlockSignerABI, _ = abi.JSON(strings.NewReader(blockSignerContract.BlockSignerABI))
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetSigners(statedb *state.StateDB, parsed abi.ABI, block *types.Block) []common.Address {
|
func GetSigners(statedb *state.StateDB, block *types.Block) []common.Address {
|
||||||
methodName := "getSigners"
|
methodName := "getSigners"
|
||||||
fmt.Printf("---%s---\n", methodName)
|
fmt.Printf("---%s---\n", methodName)
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ var (
|
||||||
ParsedRandomizeABI, _ = abi.JSON(strings.NewReader(randomizeContract.XDCRandomizeABI))
|
ParsedRandomizeABI, _ = abi.JSON(strings.NewReader(randomizeContract.XDCRandomizeABI))
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetSecret(statedb *state.StateDB, parsed abi.ABI, address common.Address) [][]byte {
|
func GetSecret(statedb *state.StateDB, address common.Address) [][32]byte {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
fmt.Printf("--------GetSecret---------\n")
|
fmt.Printf("--------GetSecret---------\n")
|
||||||
|
|
||||||
|
|
@ -32,10 +32,10 @@ func GetSecret(statedb *state.StateDB, parsed abi.ABI, address common.Address) [
|
||||||
key := getLocDynamicArrAtElement(common.BigToHash(locSecret), i, 1)
|
key := getLocDynamicArrAtElement(common.BigToHash(locSecret), i, 1)
|
||||||
keys = append(keys, key)
|
keys = append(keys, key)
|
||||||
}
|
}
|
||||||
rets := [][]byte{}
|
rets := [][32]byte{}
|
||||||
for _, key := range keys {
|
for _, key := range keys {
|
||||||
ret := statedb.GetState(common.HexToAddress(common.RandomizeSMC), key)
|
ret := statedb.GetState(common.HexToAddress(common.RandomizeSMC), key)
|
||||||
rets = append(rets, ret.Bytes())
|
rets = append(rets, ret)
|
||||||
fmt.Printf("ret hex: %v - ret byte: %v\n", ret.Hex(), ret.Bytes())
|
fmt.Printf("ret hex: %v - ret byte: %v\n", ret.Hex(), ret.Bytes())
|
||||||
}
|
}
|
||||||
elapsed := time.Since(start)
|
elapsed := time.Since(start)
|
||||||
|
|
@ -44,7 +44,7 @@ func GetSecret(statedb *state.StateDB, parsed abi.ABI, address common.Address) [
|
||||||
return rets
|
return rets
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetOpening(statedb *state.StateDB, parsed abi.ABI, address common.Address) []byte {
|
func GetOpening(statedb *state.StateDB, address common.Address) [32]byte {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
fmt.Printf("--------GetOpening---------\n")
|
fmt.Printf("--------GetOpening---------\n")
|
||||||
|
|
||||||
|
|
@ -54,5 +54,5 @@ func GetOpening(statedb *state.StateDB, parsed abi.ABI, address common.Address)
|
||||||
fmt.Printf("ret hex: %v - ret byte: %v\n", ret.Hex(), ret.Bytes())
|
fmt.Printf("ret hex: %v - ret byte: %v\n", ret.Hex(), ret.Bytes())
|
||||||
elapsed := time.Since(start)
|
elapsed := time.Since(start)
|
||||||
fmt.Printf("Execution time: %s\n", elapsed)
|
fmt.Printf("Execution time: %s\n", elapsed)
|
||||||
return ret.Bytes()
|
return ret
|
||||||
}
|
}
|
||||||
|
|
@ -50,7 +50,7 @@ func GetCandidates(statedb *state.StateDB, parsed abi.ABI) []common.Address {
|
||||||
return rets
|
return rets
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetCandidateOwner(statedb *state.StateDB, parsed abi.ABI, candidate common.Address) common.Address {
|
func GetCandidateOwner(statedb *state.StateDB, candidate common.Address) common.Address {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
fmt.Printf("--------GetCandidateOwner---------\n")
|
fmt.Printf("--------GetCandidateOwner---------\n")
|
||||||
|
|
||||||
|
|
@ -81,7 +81,7 @@ func GetCandidateCap(statedb *state.StateDB, parsed abi.ABI, candidate common.Ad
|
||||||
return ret.Hex()
|
return ret.Hex()
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetVoters(statedb *state.StateDB, parsed abi.ABI, candidate common.Address) []common.Address {
|
func GetVoters(statedb *state.StateDB, candidate common.Address) []common.Address {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
fmt.Printf("--------GetVoters---------\n")
|
fmt.Printf("--------GetVoters---------\n")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue