Commit 6f9e38bc authored by George Hotz's avatar George Hotz

oracle works

parent 9352cc4a
...@@ -83,7 +83,21 @@ func (s *StateDB) GetState(fakeaddr common.Address, hash common.Hash) common.Has ...@@ -83,7 +83,21 @@ func (s *StateDB) GetState(fakeaddr common.Address, hash common.Hash) common.Has
} }
if ram[nret] == 0xC { if ram[nret] == 0xC {
syscall := ram[0xc0000008] syscall := ram[0xc0000008]
if syscall == 4004 { if syscall == 4020 {
oracle_hash := make([]byte, 0x20)
for i := uint32(0); i < 0x20; i += 4 {
binary.BigEndian.PutUint32(oracle_hash[i:i+4], ram[0x30001000+i])
}
hash := common.BytesToHash(oracle_hash)
key := fmt.Sprintf("/tmp/eth/%s", hash)
value, _ := ioutil.ReadFile(key)
ram[0x31000000] = uint32(len(value))
value = append(value, 0, 0, 0)
for i := uint32(0); i < ram[0x31000000]; i += 4 {
ram[0x31000004+i] = binary.BigEndian.Uint32(value[i : i+4])
}
} else if syscall == 4004 {
len := ram[0xc0000018] len := ram[0xc0000018]
buf := make([]byte, len+0x10) buf := make([]byte, len+0x10)
addr := ram[0xc0000014] addr := ram[0xc0000014]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment