Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
c21293cd
Commit
c21293cd
authored
Mar 17, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bloom
parent
0fa7859b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
14 deletions
+20
-14
bloom9.go
core/types/bloom9.go
+4
-3
gh_test.go
tests/vm/gh_test.go
+15
-10
environment.go
vm/environment.go
+1
-1
No files found.
core/types/bloom9.go
View file @
c21293cd
...
...
@@ -28,7 +28,7 @@ func LogsBloom(logs state.Logs) *big.Int {
}
for
_
,
b
:=
range
data
{
bin
.
Or
(
bin
,
common
.
BigD
(
bloom9
(
crypto
.
Sha3
(
b
[
:
]))
.
Bytes
(
)))
bin
.
Or
(
bin
,
bloom9
(
crypto
.
Sha3
(
b
[
:
]
)))
}
}
...
...
@@ -38,9 +38,10 @@ func LogsBloom(logs state.Logs) *big.Int {
func
bloom9
(
b
[]
byte
)
*
big
.
Int
{
r
:=
new
(
big
.
Int
)
for
i
:=
0
;
i
<
1
6
;
i
+=
2
{
for
i
:=
0
;
i
<
6
;
i
+=
2
{
t
:=
big
.
NewInt
(
1
)
b
:=
uint
(
b
[
i
+
1
])
+
1024
*
(
uint
(
b
[
i
])
&
1
)
//b := uint(b[i+1]) + 512*(uint(b[i])&1)
b
:=
(
uint
(
b
[
i
+
1
])
+
(
uint
(
b
[
i
])
<<
8
))
&
511
r
.
Or
(
r
,
t
.
Lsh
(
t
,
b
))
}
...
...
tests/vm/gh_test.go
View file @
c21293cd
...
...
@@ -2,11 +2,13 @@ package vm
import
(
"bytes"
"fmt"
"math/big"
"strconv"
"testing"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/state"
...
...
@@ -80,6 +82,9 @@ func RunVmTest(p string, t *testing.T) {
helper
.
CreateFileTests
(
t
,
p
,
&
tests
)
for
name
,
test
:=
range
tests
{
if
name
!=
"log2_nonEmptyMem"
{
continue
}
db
,
_
:=
ethdb
.
NewMemDatabase
()
statedb
:=
state
.
New
(
common
.
Hash
{},
db
)
for
addr
,
account
:=
range
test
.
Pre
{
...
...
@@ -167,16 +172,16 @@ func RunVmTest(p string, t *testing.T) {
if
len
(
test
.
Logs
)
!=
len
(
logs
)
{
t
.
Errorf
(
"log length mismatch. Expected %d, got %d"
,
len
(
test
.
Logs
),
len
(
logs
))
}
else
{
/*
fmt
.
Println
(
"A"
,
test
.
Logs
)
fmt
.
Println
(
"B"
,
logs
)
for
i
,
log
:=
range
test
.
Logs
{
genBloom
:=
common
.
LeftPadBytes
(
types
.
LogsBloom
(
state
.
Logs
{
logs
[
i
]})
.
Bytes
(),
256
)
fmt
.
Println
(
"A BLOOM"
,
log
.
BloomF
)
fmt
.
Printf
(
"B BLOOM %x
\n
"
,
genBloom
)
if
!
bytes
.
Equal
(
genBloom
,
common
.
Hex2Bytes
(
log
.
BloomF
))
{
t.Errorf("bloom mismatch"
)
t
.
Errorf
(
"'%s' bloom mismatch"
,
name
)
}
}
*/
}
}
//statedb.Trie().PrintRoot()
...
...
vm/environment.go
View file @
c21293cd
...
...
@@ -88,5 +88,5 @@ func (self *Log) RlpData() interface{} {
*/
func
(
self
*
Log
)
String
()
string
{
return
fmt
.
Sprintf
(
"
[A=%x T=%x D=%x]"
,
self
.
address
,
self
.
topics
,
self
.
data
)
return
fmt
.
Sprintf
(
"
{%x %x %x}"
,
self
.
address
,
self
.
data
,
self
.
topics
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment