mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
sharding transaction tests
Former-commit-id: 05978a0028b27bc99cdbd2cdf8f66c78a48444be [formerly c05cd8f789a0f2a3b24b4a41eda2d6d89c33e41b] Former-commit-id: 04955bc0a35f4932b5ff28c98393ff79d0356d4a
This commit is contained in:
parent
cd9febd964
commit
04271a89fe
@ -33,7 +33,7 @@ type txdata struct {
|
||||
|
||||
// Sharding specific fields
|
||||
// TODO: Figure out exact format of accesslist. array of arrays of addr + prefixes?
|
||||
AccessList []*common.Address `json:"accessList" gencodec:"required"`
|
||||
AccessList []common.Address `json:"accessList" gencodec:"required"`
|
||||
|
||||
// This is only used when marshaling to JSON.
|
||||
Hash *common.Hash `json:"hash" rlp:"-"`
|
||||
@ -49,15 +49,15 @@ type txdataMarshaling struct {
|
||||
ShardID hexutil.Uint64
|
||||
}
|
||||
|
||||
func NewShardingTransaction(nonce uint64, to common.Address, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, accessList []*common.Address) *ShardingTransaction {
|
||||
func NewShardingTransaction(nonce uint64, to common.Address, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, accessList []common.Address) *ShardingTransaction {
|
||||
return newShardingTransaction(nonce, &to, amount, gasLimit, gasPrice, data, accessList)
|
||||
}
|
||||
|
||||
func NewContractCreation(nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, accessList []*common.Address) *ShardingTransaction {
|
||||
func NewContractCreation(nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, accessList []common.Address) *ShardingTransaction {
|
||||
return newShardingTransaction(nonce, nil, amount, gasLimit, gasPrice, data, accessList)
|
||||
}
|
||||
|
||||
func newShardingTransaction(nonce uint64, to *common.Address, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, accessList []*common.Address) *ShardingTransaction {
|
||||
func newShardingTransaction(nonce uint64, to *common.Address, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, accessList []common.Address) *ShardingTransaction {
|
||||
if len(data) > 0 {
|
||||
data = common.CopyBytes(data)
|
||||
}
|
||||
|
@ -5,11 +5,33 @@ import (
|
||||
//"fmt"
|
||||
//"math/rand"
|
||||
//"os"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"math/big"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var (
|
||||
txSimple = NewShardingTransaction(
|
||||
0,
|
||||
common.HexToAddress("095e7baea6a6c7c4c2dfeb977efac326af552d87"),
|
||||
// amount
|
||||
big.NewInt(10),
|
||||
// gasLimit
|
||||
1000000,
|
||||
// gasPrice
|
||||
big.NewInt(1),
|
||||
// data
|
||||
common.FromHex("hello world this is the data"),
|
||||
// access list
|
||||
[]common.Address{common.HexToAddress("032e7baea6a6c7c4c2dfe98392932326af552d87"), common.HexToAddress("083e7baea6a6c7c4c2dfeb97710293843f552d87")},
|
||||
)
|
||||
)
|
||||
|
||||
func TestCreation(t *testing.T) {
|
||||
if 1 != 2 {
|
||||
t.Fatalf("Values are not equal")
|
||||
if txSimple.ChainID().Cmp(big.NewInt(1)) != 0 {
|
||||
t.Fatalf("ChainID invalid")
|
||||
}
|
||||
if txSimple.ShardID().Cmp(big.NewInt(1)) != 0 {
|
||||
t.Fatalf("ShardID invalid")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user