(╯°□°)╯︵ ┻━┻

This commit is contained in:
Jae Kwon
2015-04-17 17:39:50 -07:00
parent 2668b59631
commit b11ca1bbfc
12 changed files with 27 additions and 21 deletions
+2 -2
View File
@@ -39,7 +39,7 @@ func ecrecoverFunc(input []byte, gas *uint64) (output []byte, err error) {
return nil, err
}
hashed := sha3.Sha3(recovered[1:])
return RightPadBytes(hashed, 32), nil
return LeftPadBytes(hashed, 32), nil
}
func sha256Func(input []byte, gas *uint64) (output []byte, err error) {
@@ -73,7 +73,7 @@ func ripemd160Func(input []byte, gas *uint64) (output []byte, err error) {
if err != nil {
panic(err)
}
return RightPadBytes(hasher.Sum(nil), 32), nil
return LeftPadBytes(hasher.Sum(nil), 32), nil
}
func identityFunc(input []byte, gas *uint64) (output []byte, err error) {
+3 -2
View File
@@ -51,7 +51,7 @@ func (st *Stack) PushBytes(bz []byte) {
if len(bz) != 32 {
panic("Invalid bytes size: expected 32")
}
st.Push(RightPadWord256(bz))
st.Push(LeftPadWord256(bz))
}
func (st *Stack) Push64(i uint64) {
@@ -73,7 +73,8 @@ func (st *Stack) PopBytes() []byte {
}
func (st *Stack) Pop64() uint64 {
return GetUint64(st.Pop().Bytes())
d := st.Pop()
return Uint64FromWord256(d)
}
func (st *Stack) Len() int {
+1 -1
View File
@@ -90,5 +90,5 @@ func createAddress(creator *Account) Word256 {
temp := make([]byte, 32+8)
copy(temp, creator.Address[:])
PutUint64(temp[32:], nonce)
return RightPadWord256(sha3.Sha3(temp)[:20])
return LeftPadWord256(sha3.Sha3(temp)[:20])
}
+2 -2
View File
@@ -64,10 +64,10 @@ func TestSubcurrency(t *testing.T) {
st := newAppState()
// Create accounts
account1 := &Account{
Address: RightPadWord256(makeBytes(20)),
Address: LeftPadWord256(makeBytes(20)),
}
account2 := &Account{
Address: RightPadWord256(makeBytes(20)),
Address: LeftPadWord256(makeBytes(20)),
}
st.accounts[account1.Address.String()] = account1
st.accounts[account2.Address.String()] = account2