Skip to content

Commit 5e95ee8

Browse files
committed
Split tests
Signed-off-by: Giuseppe Bertone <[email protected]>
1 parent 83573f9 commit 5e95ee8

File tree

1 file changed

+56
-50
lines changed

1 file changed

+56
-50
lines changed

packages/server/tests/acceptance/rpc_batch1.spec.ts

Lines changed: 56 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,56 +1554,62 @@ describe('@api-batch-1 RPC Server Acceptance Tests', function () {
15541554
);
15551555
});
15561556

1557-
withOverriddenEnvsInMochaTest(
1558-
{
1559-
GAS_PRICE_TINY_BAR_BUFFER: 2000000000000,
1560-
MAX_GAS_ALLOWANCE_HBAR: 100,
1561-
},
1562-
() => {
1563-
it('should execute "eth_sendRawTransaction" and pays the total amount of the fees on behalf of the sender', async function () {
1564-
const balanceBefore = await relay.getBalance(accounts[2].wallet.address, 'latest', requestId);
1565-
1566-
const transaction = {
1567-
type: 1,
1568-
chainId: Number(CHAIN_ID),
1569-
nonce: await relay.getAccountNonce(accounts[2].wallet.address, requestId),
1570-
gasPrice: 0,
1571-
gasLimit: Constants.MAX_TRANSACTION_FEE_THRESHOLD,
1572-
data: '0x' + '00'.repeat(Constants.CONTRACT_CODE_SIZE_LIMIT),
1573-
};
1574-
const signedTx = await accounts[2].wallet.signTransaction(transaction);
1575-
const transactionHash = await relay.sendRawTransaction(signedTx, requestId);
1576-
const info = await mirrorNode.get(`/contracts/results/${transactionHash}`, requestId);
1577-
expect(info).to.have.property('contract_id');
1578-
expect(info.contract_id).to.not.be.null;
1579-
expect(info).to.have.property('created_contract_ids');
1580-
expect(info.created_contract_ids.length).to.be.equal(1);
1581-
1582-
const balanceAfter = await relay.getBalance(accounts[2].wallet.address, 'latest', requestId);
1583-
expect(balanceAfter).to.be.equal(balanceBefore);
1584-
1585-
const transaction2 = {
1586-
type: 2,
1587-
chainId: Number(CHAIN_ID),
1588-
nonce: await relay.getAccountNonce(accounts[2].wallet.address, requestId),
1589-
maxPriorityFeePerGas: 0,
1590-
maxFeePerGas: 0,
1591-
gasLimit: Constants.MAX_TRANSACTION_FEE_THRESHOLD,
1592-
data: '0x' + '00'.repeat(Constants.CONTRACT_CODE_SIZE_LIMIT),
1593-
};
1594-
const signedTx2 = await accounts[2].wallet.signTransaction(transaction2);
1595-
const transactionHash2 = await relay.sendRawTransaction(signedTx2, requestId);
1596-
const info2 = await mirrorNode.get(`/contracts/results/${transactionHash2}`, requestId);
1597-
expect(info2).to.have.property('contract_id');
1598-
expect(info2.contract_id).to.not.be.null;
1599-
expect(info2).to.have.property('created_contract_ids');
1600-
expect(info2.created_contract_ids.length).to.be.equal(1);
1601-
1602-
const balanceAfter2 = await relay.getBalance(accounts[2].wallet.address, 'latest', requestId);
1603-
expect(balanceAfter2).to.be.equal(balanceBefore);
1604-
});
1605-
},
1606-
);
1557+
describe('Check subsidizing gas fees', async function () {
1558+
withOverriddenEnvsInMochaTest(
1559+
{
1560+
GAS_PRICE_TINY_BAR_BUFFER: 2000000000000,
1561+
MAX_GAS_ALLOWANCE_HBAR: 100,
1562+
},
1563+
() => {
1564+
it('should execute a pre EIP-1559 transaction with "eth_sendRawTransaction" and pays the total amount of the fees on behalf of the sender', async function () {
1565+
const balanceBefore = await relay.getBalance(accounts[2].wallet.address, 'latest', requestId);
1566+
1567+
const transaction = {
1568+
type: 1,
1569+
chainId: Number(CHAIN_ID),
1570+
nonce: await relay.getAccountNonce(accounts[2].wallet.address, requestId),
1571+
gasPrice: 0,
1572+
gasLimit: Constants.MAX_TRANSACTION_FEE_THRESHOLD,
1573+
data: '0x' + '00'.repeat(Constants.CONTRACT_CODE_SIZE_LIMIT),
1574+
};
1575+
const signedTx = await accounts[2].wallet.signTransaction(transaction);
1576+
const transactionHash = await relay.sendRawTransaction(signedTx, requestId);
1577+
const info = await mirrorNode.get(`/contracts/results/${transactionHash}`, requestId);
1578+
expect(info).to.have.property('contract_id');
1579+
expect(info.contract_id).to.not.be.null;
1580+
expect(info).to.have.property('created_contract_ids');
1581+
expect(info.created_contract_ids.length).to.be.equal(1);
1582+
1583+
const balanceAfter = await relay.getBalance(accounts[2].wallet.address, 'latest', requestId);
1584+
expect(balanceAfter).to.be.equal(balanceBefore);
1585+
});
1586+
1587+
it('should execute a post EIP-1559 transaction with "eth_sendRawTransaction" and pays the total amount of the fees on behalf of the sender', async function () {
1588+
const balanceBefore = await relay.getBalance(accounts[2].wallet.address, 'latest', requestId);
1589+
1590+
const transaction = {
1591+
type: 2,
1592+
chainId: Number(CHAIN_ID),
1593+
nonce: await relay.getAccountNonce(accounts[2].wallet.address, requestId),
1594+
maxPriorityFeePerGas: 0,
1595+
maxFeePerGas: 0,
1596+
gasLimit: Constants.MAX_TRANSACTION_FEE_THRESHOLD,
1597+
data: '0x' + '00'.repeat(Constants.CONTRACT_CODE_SIZE_LIMIT),
1598+
};
1599+
const signedTx = await accounts[2].wallet.signTransaction(transaction);
1600+
const transactionHash = await relay.sendRawTransaction(signedTx, requestId);
1601+
const info = await mirrorNode.get(`/contracts/results/${transactionHash}`, requestId);
1602+
expect(info).to.have.property('contract_id');
1603+
expect(info.contract_id).to.not.be.null;
1604+
expect(info).to.have.property('created_contract_ids');
1605+
expect(info.created_contract_ids.length).to.be.equal(1);
1606+
1607+
const balanceAfter = await relay.getBalance(accounts[2].wallet.address, 'latest', requestId);
1608+
expect(balanceAfter).to.be.equal(balanceBefore);
1609+
});
1610+
},
1611+
);
1612+
});
16071613

16081614
describe('Prechecks', async function () {
16091615
it('should fail "eth_sendRawTransaction" for transaction with incorrect chain_id', async function () {

0 commit comments

Comments
 (0)