Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
envestcc committed Nov 24, 2023
1 parent 5640159 commit b3879b5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
11 changes: 9 additions & 2 deletions action/protocol/execution/protocol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ type (
}
)

var (
fixedTime = time.Unix(genesis.Default.Timestamp, 0)
)

func (eb *ExpectedBalance) Balance() *big.Int {
balance, ok := new(big.Int).SetString(eb.RawBalance, 10)
if !ok {
Expand Down Expand Up @@ -352,7 +356,7 @@ func (sct *SmartContractTest) runExecutions(
}
hashes = append(hashes, selpHash)
}
blk, err := bc.MintNewBlock(time.Unix(1234567890, 0))
blk, err := bc.MintNewBlock(fixedTime)
if err != nil {
return nil, nil, err
}
Expand Down Expand Up @@ -424,6 +428,7 @@ func (sct *SmartContractTest) prepareBlockchain(
cfg.Genesis.Blockchain.QuebecBlockHeight = 0
cfg.Genesis.Blockchain.RedseaBlockHeight = 0
cfg.Genesis.Blockchain.SumatraBlockHeight = 0
cfg.Genesis.ActionGasLimit = 10000000
}
for _, expectedBalance := range sct.InitBalances {
cfg.Genesis.InitBalanceMap[expectedBalance.Account] = expectedBalance.Balance().String()
Expand Down Expand Up @@ -472,7 +477,9 @@ func (sct *SmartContractTest) prepareBlockchain(
r.NoError(reward.Register(registry))

r.NotNil(bc)
execution := NewProtocol(dao.GetBlockHash, rewarding.DepositGasWithSGD, nil, func(u uint64) (time.Time, error) { return time.Time{}, nil })
execution := NewProtocol(dao.GetBlockHash, rewarding.DepositGasWithSGD, nil, func(h uint64) (time.Time, error) {
return fixedTime.Add(time.Duration(h) * 5 * time.Second), nil
})
r.NoError(execution.Register(registry))
r.NoError(bc.Start(ctx))

Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion action/protocol/execution/testdata-shanghai/push0.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"rawAmount": "0",
"rawGasLimit": 5000000,
"rawGasPrice": "0",
"rawExpectedGasConsumed": 111417,
"rawExpectedGasConsumed": 700391,
"expectedStatus": 1,
"expectedBalances": [],
"comment": "deploy push0 contract"
Expand Down
2 changes: 1 addition & 1 deletion action/protocol/execution/testdata-shanghai/send-eth.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"rawGasLimit": 1000000,
"rawGasPrice": "0",
"rawAccessList": [],
"rawExpectedGasConsumed": 61113,
"rawExpectedGasConsumed": 58613,
"expectedStatus": 1,
"expectedBalances": [{
"account": "io1rc2d2de7rtuucalsqv4d9ng0h297t63w7wvlph",
Expand Down

0 comments on commit b3879b5

Please sign in to comment.