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
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
a3e01638
Commit
a3e01638
authored
5 years ago
by
atvanguard
Browse files
Options
Downloads
Patches
Plain Diff
Test isValidatorAction
🚧
parent
27fc66ef
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
consensus/bor/bor.go
+1
-0
1 addition, 0 deletions
consensus/bor/bor.go
consensus/bor/bor_test.go
+57
-0
57 additions, 0 deletions
consensus/bor/bor_test.go
with
58 additions
and
0 deletions
consensus/bor/bor.go
+
1
−
0
View file @
a3e01638
...
@@ -1233,6 +1233,7 @@ func (c *Bor) isValidatorAction(chain consensus.ChainReader, from common.Address
...
@@ -1233,6 +1233,7 @@ func (c *Bor) isValidatorAction(chain consensus.ChainReader, from common.Address
}
}
}
}
// @todo only either of proposeState and proposeSpan should pass this check
// @todo only either of proposeState and proposeSpan should pass this check
fmt
.
Println
(
"tx.Data"
,
tx
.
Data
())
return
_isValidatorAction
return
_isValidatorAction
}
}
...
...
This diff is collapsed.
Click to expand it.
consensus/bor/bor_test.go
0 → 100644
+
57
−
0
View file @
a3e01638
package
bor
import
(
"math/big"
"testing"
"github.com/maticnetwork/bor/common"
"github.com/maticnetwork/bor/core"
"github.com/maticnetwork/bor/core/rawdb"
"github.com/maticnetwork/bor/core/types"
"github.com/maticnetwork/bor/core/vm"
"github.com/maticnetwork/bor/crypto"
"github.com/maticnetwork/bor/internal/ethapi"
"github.com/maticnetwork/bor/params"
)
type
MockEthAPI
struct
{}
// func (ethapi *MockEthAPI) call()
func
TestIsValidatorAction
(
t
*
testing
.
T
)
{
var
(
db
=
rawdb
.
NewMemoryDatabase
()
key
,
_
=
crypto
.
HexToECDSA
(
"b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291"
)
addr
=
crypto
.
PubkeyToAddress
(
key
.
PublicKey
)
// bor = New(¶ms.ChainConfig{}, db, ðapi.PublicBlockChainAPI{})
// signer = new(types.HomesteadSigner)
)
genspec
:=
&
core
.
Genesis
{
ExtraData
:
make
([]
byte
,
extraVanity
+
common
.
AddressLength
+
extraSeal
),
Alloc
:
map
[
common
.
Address
]
core
.
GenesisAccount
{
addr
:
{
Balance
:
big
.
NewInt
(
1
)},
},
}
copy
(
genspec
.
ExtraData
[
extraVanity
:
],
addr
[
:
])
genspec
.
MustCommit
(
db
)
// genesis := genspec.MustCommit(db)
config
:=
&
params
.
ChainConfig
{
Bor
:
&
params
.
BorConfig
{
ValidatorContract
:
"0x0000000000000000000000000000000000001000"
,
StateReceiverContract
:
"0x0000000000000000000000000000000000001001"
,
},
}
bor
:=
New
(
config
,
db
,
&
ethapi
.
PublicBlockChainAPI
{})
chain
,
err
:=
core
.
NewBlockChain
(
db
,
nil
,
config
,
bor
,
vm
.
Config
{},
nil
)
if
err
!=
nil
{
t
.
Fatalf
(
"%s"
,
err
)
}
tx
:=
types
.
NewTransaction
(
0
,
addr
,
// to - Just a place holder
big
.
NewInt
(
0
),
0
/* fix gas limit */
,
big
.
NewInt
(
0
),
nil
,
// data
)
bor
.
isValidatorAction
(
chain
,
addr
,
tx
)
}
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