Skip to content

Commit

Permalink
fixed ibft tests (#1876) (#1877)
Browse files Browse the repository at this point in the history
* fixed ibft tests (#1876)

* fixed ibft e2e test

* fixed ibft e2e test

* fix TestTxPool_RecoverableError
  • Loading branch information
rachit77 authored Sep 6, 2023
1 parent daf9402 commit 52115cc
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 19 deletions.
8 changes: 4 additions & 4 deletions e2e/framework/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func GetValidatorSet(from types.Address, rpcClient *jsonrpc.Client) ([]types.Add
From: ethgo.Address(from),
To: &toAddress,
Data: selector,
GasPrice: 100000000,
GasPrice: 1000000000,
Value: big.NewInt(0),
},
ethgo.Latest,
Expand Down Expand Up @@ -125,7 +125,7 @@ func StakeAmount(
txn := &PreparedTransaction{
From: from,
To: &staking.AddrStakingContract,
GasPrice: big.NewInt(10000),
GasPrice: big.NewInt(1000000000),
Gas: 1000000,
Value: amount,
Input: MethodSig("stake"),
Expand Down Expand Up @@ -153,7 +153,7 @@ func UnstakeAmount(
txn := &PreparedTransaction{
From: from,
To: &staking.AddrStakingContract,
GasPrice: big.NewInt(DefaultGasPrice),
GasPrice: big.NewInt(1000000000),
Gas: DefaultGasLimit,
Value: big.NewInt(0),
Input: MethodSig("unstake"),
Expand Down Expand Up @@ -185,7 +185,7 @@ func GetStakedAmount(from types.Address, rpcClient *jsonrpc.Client) (*big.Int, e
From: ethgo.Address(from),
To: &toAddress,
Data: selector,
GasPrice: 100000000,
GasPrice: 1000000000,
Value: big.NewInt(0),
},
ethgo.Latest,
Expand Down
1 change: 1 addition & 0 deletions e2e/framework/testserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ func (t *Txn) Deploy(input []byte) *Txn {
func (t *Txn) Transfer(to ethgo.Address, value *big.Int) *Txn {
t.raw.To = &to
t.raw.Value = value
t.raw.GasPrice = ethgo.Gwei(2).Uint64()

return t
}
Expand Down
6 changes: 3 additions & 3 deletions e2e/ibft_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestIbft_Transfer(t *testing.T) {
txn := &framework.PreparedTransaction{
From: senderAddr,
To: &receiverAddr,
GasPrice: big.NewInt(10000),
GasPrice: big.NewInt(2000000000),
Gas: 1000000,
Value: framework.EthToWei(1),
}
Expand Down Expand Up @@ -141,7 +141,7 @@ func TestIbft_TransactionFeeRecipient(t *testing.T) {
txn := &framework.PreparedTransaction{
From: senderAddr,
To: &receiverAddr,
GasPrice: big.NewInt(10000),
GasPrice: big.NewInt(1000000000),
Gas: 1000000,
Value: tc.txAmount,
}
Expand All @@ -150,7 +150,7 @@ func TestIbft_TransactionFeeRecipient(t *testing.T) {
// Deploy contract
deployTx := &framework.PreparedTransaction{
From: senderAddr,
GasPrice: big.NewInt(0), // don't want gas fee to paid to a proposer
GasPrice: big.NewInt(1000000000), // fees should be greater than base fee
Gas: 1000000,
Value: big.NewInt(0),
Input: framework.MethodSig("setA1"),
Expand Down
2 changes: 1 addition & 1 deletion e2e/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func TestNewFilter_Block(t *testing.T) {
if _, sendErr := srv.SendRawTx(ctx, &framework.PreparedTransaction{
From: from,
To: &to,
GasPrice: big.NewInt(10000),
GasPrice: big.NewInt(1000000000),
Gas: 1000000,
Value: big.NewInt(10000),
}, fromKey); err != nil {
Expand Down
8 changes: 4 additions & 4 deletions e2e/pos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ func TestPoS_UnstakeExploit(t *testing.T) {
senderKey, senderAddr := tests.GenerateKeyAndAddr(t)
bigDefaultStakedBalance := getBigDefaultStakedBalance(t)
defaultBalance := framework.EthToWei(100)
bigGasPrice := big.NewInt(framework.DefaultGasPrice)
bigGasPrice := big.NewInt(1000000000)

devInterval := 5 // s
numDummyValidators := 5
Expand Down Expand Up @@ -477,7 +477,7 @@ func TestPoS_StakeUnstakeExploit(t *testing.T) {
stakingContractAddr := staking.AddrStakingContract
bigDefaultStakedBalance := getBigDefaultStakedBalance(t)
defaultBalance := framework.EthToWei(100)
bigGasPrice := big.NewInt(framework.DefaultGasPrice)
bigGasPrice := big.NewInt(1000000000)

senderKey, senderAddr := tests.GenerateKeyAndAddr(t)
numDummyStakers := 100
Expand Down Expand Up @@ -625,7 +625,7 @@ func TestPoS_StakeUnstakeWithinSameBlock(t *testing.T) {

stakingContractAddr := staking.AddrStakingContract
defaultBalance := framework.EthToWei(100)
bigGasPrice := big.NewInt(framework.DefaultGasPrice)
bigGasPrice := big.NewInt(10000000000)

senderKey, senderAddr := tests.GenerateKeyAndAddr(t)
numDummyStakers := 10
Expand Down Expand Up @@ -818,7 +818,7 @@ func TestSnapshotUpdating(t *testing.T) {
&framework.PreparedTransaction{
From: faucetAddr,
To: &firstNonValidatorAddr,
GasPrice: big.NewInt(10000),
GasPrice: big.NewInt(1000000000),
Gas: 1000000,
Value: framework.EthToWei(300),
}, faucetKey)
Expand Down
2 changes: 1 addition & 1 deletion e2e/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func TestEthTransfer(t *testing.T) {
txn := &framework.PreparedTransaction{
From: testCase.sender,
To: &testCase.recipient,
GasPrice: big.NewInt(1048576),
GasPrice: big.NewInt(1000000000),
Gas: 1000000,
Value: testCase.amount,
}
Expand Down
10 changes: 5 additions & 5 deletions e2e/txpool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func generateReq(params generateTxReqParams) *txpoolOp.AddTxnReq {
}

func TestTxPool_ErrorCodes(t *testing.T) {
gasPrice := big.NewInt(10000)
gasPrice := big.NewInt(1000000000)
gasFeeCap := big.NewInt(1000000000)
gasTipCap := big.NewInt(100000000)
devInterval := 5
Expand Down Expand Up @@ -209,7 +209,7 @@ func TestTxPool_TransactionCoalescing(t *testing.T) {
// Add tx with nonce 1
// -> check if both tx with nonce 1 and tx with nonce 2 are parsed
// Predefined values
gasPrice := big.NewInt(10000)
gasPrice := big.NewInt(1000000000)

referenceKey, referenceAddr := tests.GenerateKeyAndAddr(t)
defaultBalance := framework.EthToWei(10)
Expand Down Expand Up @@ -395,7 +395,7 @@ func TestTxPool_RecoverableError(t *testing.T) {
transactions := []*types.Transaction{
{
Nonce: 0,
GasPrice: big.NewInt(framework.DefaultGasPrice),
GasPrice: big.NewInt(1000000000),
Gas: 22000,
To: &receiverAddress,
Value: oneEth,
Expand All @@ -404,7 +404,7 @@ func TestTxPool_RecoverableError(t *testing.T) {
},
{
Nonce: 1,
GasPrice: big.NewInt(framework.DefaultGasPrice),
GasPrice: big.NewInt(1000000000),
Gas: 22000,
To: &receiverAddress,
Value: oneEth,
Expand Down Expand Up @@ -504,7 +504,7 @@ func TestTxPool_GetPendingTx(t *testing.T) {
// Construct the transaction
signedTx, err := signer.SignTx(&types.Transaction{
Nonce: 0,
GasPrice: big.NewInt(0),
GasPrice: big.NewInt(1000000000),
Gas: framework.DefaultGasLimit - 1,
To: &receiverAddress,
Value: oneEth,
Expand Down
2 changes: 1 addition & 1 deletion e2e/websocket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func TestWS_Response(t *testing.T) {
_, err = srv.SendRawTx(ctx, &framework.PreparedTransaction{
From: preminedAccounts[0].address,
To: &preminedAccounts[1].address,
GasPrice: big.NewInt(10000),
GasPrice: big.NewInt(1000000000),
Gas: 1000000,
Value: big.NewInt(10000),
}, preminedAccounts[0].key)
Expand Down

0 comments on commit 52115cc

Please sign in to comment.