good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
github
maticnetwork
bor
Commits
10c4e89f
Commit
10c4e89f
authored
Mar 10, 2022
by
Shivam Sharma
Committed by
Victor Castell
Mar 10, 2022
Browse files
Options
Downloads
Patches
Plain Diff
fix: added basic span read
parent
28963d5c
No related branches found
No related tags found
No related merge requests found
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
consensus/bor/bor.go
+30
-4
30 additions, 4 deletions
consensus/bor/bor.go
consensus/bor/bor_test.go
+25
-0
25 additions, 0 deletions
consensus/bor/bor_test.go
consensus/bor/hardcoded_spans.go
+29862
-0
29862 additions, 0 deletions
consensus/bor/hardcoded_spans.go
with
29917 additions
and
4 deletions
consensus/bor/bor.go
+
30
−
4
View file @
10c4e89f
...
...
@@ -1074,6 +1074,31 @@ func (c *Bor) fetchAndCommitSpan(
}
heimdallSpan
=
*
s
}
else
{
var
spanArray
[]
*
ResponseWithHeight
if
err
:=
json
.
Unmarshal
([]
byte
(
SPANS
),
&
spanArray
);
err
!=
nil
{
return
err
}
spanInJSON
:=
false
for
_
,
val
:=
range
spanArray
{
var
tempHeimdallSpan
HeimdallSpan
if
err
:=
json
.
Unmarshal
(
val
.
Result
,
&
tempHeimdallSpan
);
err
!=
nil
{
return
err
}
if
tempHeimdallSpan
.
ID
==
newSpanID
{
heimdallSpan
=
tempHeimdallSpan
log
.
Info
(
"Got span from local"
,
"span"
,
heimdallSpan
.
Span
.
ID
)
spanInJSON
=
true
break
}
}
if
!
spanInJSON
{
response
,
err
:=
c
.
HeimdallClient
.
FetchWithRetry
(
fmt
.
Sprintf
(
"bor/span/%d"
,
newSpanID
),
""
)
if
err
!=
nil
{
return
err
...
...
@@ -1083,6 +1108,7 @@ func (c *Bor) fetchAndCommitSpan(
return
err
}
}
}
// check if chain id matches with heimdall span
if
heimdallSpan
.
ChainID
!=
c
.
chainConfig
.
ChainID
.
String
()
{
...
...
This diff is collapsed.
Click to expand it.
consensus/bor/bor_test.go
+
25
−
0
View file @
10c4e89f
package
bor
import
(
"encoding/json"
"math/big"
"testing"
...
...
@@ -135,3 +136,27 @@ func TestEncodeSigHeaderJaipur(t *testing.T) {
hash
=
SealHash
(
h
,
&
params
.
BorConfig
{
JaipurBlock
:
10
})
assert
.
Equal
(
t
,
hash
,
hashWithoutBaseFee
)
}
func
TestReadHardcodedSpan
(
t
*
testing
.
T
)
{
// t.Skip()
var
spanArray
[]
*
ResponseWithHeight
if
err
:=
json
.
Unmarshal
([]
byte
(
SPANS
),
&
spanArray
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
for
i
,
val
:=
range
spanArray
{
var
tempHeimdallSpan
HeimdallSpan
if
err
:=
json
.
Unmarshal
(
val
.
Result
,
&
tempHeimdallSpan
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
t
.
Log
(
i
,
tempHeimdallSpan
.
ID
)
}
}
This diff is collapsed.
Click to expand it.
consensus/bor/hardcoded_spans.go
0 → 100644
+
29862
−
0
View file @
10c4e89f
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment