update test to use fixed address

This commit is contained in:
Sina Mahmoodi 2024-09-04 11:51:20 +02:00
parent 9a963dc5d0
commit 7198fc1225

View file

@ -1056,6 +1056,7 @@ func TestSimulateV1(t *testing.T) {
// Initialize test accounts
var (
accounts = newAccounts(3)
fixedAccount = newTestAccount()
genBlocks = 10
signer = types.HomesteadSigner{}
cac = common.HexToAddress("0x0000000000000000000000000000000000000cac")
@ -1631,19 +1632,19 @@ func TestSimulateV1(t *testing.T) {
From: &accounts[0].addr,
To: &randomAccounts[0].addr,
Value: (*hexutil.Big)(big.NewInt(50)),
Input: hex2Bytes(strings.TrimPrefix(randomAccounts[1].addr.String(), "0x")),
Input: hex2Bytes(strings.TrimPrefix(fixedAccount.addr.String(), "0x")),
}},
}},
includeTransfers: &includeTransfers,
want: []blockRes{{
Number: "0xb",
GasLimit: "0x47e7c4",
GasUsed: "0xd984",
GasUsed: "0x77dc",
Miner: coinbase,
BaseFeePerGas: "0x0",
Calls: []callRes{{
ReturnValue: "0x",
GasUsed: "0xd984",
GasUsed: "0x77dc",
Logs: []log{{
Address: transferAddress,
Topics: []common.Hash{
@ -1658,7 +1659,7 @@ func TestSimulateV1(t *testing.T) {
Topics: []common.Hash{
transferTopic,
addressToHash(randomAccounts[0].addr),
addressToHash(randomAccounts[1].addr),
addressToHash(fixedAccount.addr),
},
Data: hexutil.Bytes(common.BigToHash(big.NewInt(100)).Bytes()),
BlockNumber: hexutil.Uint64(11),
@ -2530,6 +2531,14 @@ func newAccounts(n int) (accounts []account) {
return accounts
}
func newTestAccount() account {
// testKey is a private key to use for funding a tester account.
key, _ := crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
// testAddr is the Ethereum address of the tester account.
addr := crypto.PubkeyToAddress(key.PublicKey)
return account{key: key, addr: addr}
}
func newRPCBalance(balance *big.Int) *hexutil.Big {
rpcBalance := (*hexutil.Big)(balance)
return rpcBalance