Skip to content

Commit

Permalink
Add Ethereum block tag para-test (#1831)
Browse files Browse the repository at this point in the history
* Add Ethereum block tag para-test

* unskip
  • Loading branch information
tgmichel authored Dec 13, 2022
1 parent a211fb5 commit 580a3ef
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/para-tests/moonbase/test-eth-rpc-block-tags.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { expect } from "chai";
import { ALITH_ADDRESS, ALITH_GENESIS_TRANSFERABLE_BALANCE } from "../../util/accounts";

import { describeParachain } from "../../util/setup-para-tests";

describeParachain(
"Ethereum RPC block tags",
{
parachain: {
chain: "moonbase-local",
},
},
(context) => {
it("should support pending tag", async function () {
this.timeout(150000);
await context.waitBlocks(1);
const expectedBalance = await context.web3.eth.getBalance(ALITH_ADDRESS, "pending");
expect(BigInt(expectedBalance)).to.equal(ALITH_GENESIS_TRANSFERABLE_BALANCE);
});
it("should support merge tags in the parachain context", async function () {
this.timeout(150000);
await context.waitBlocks(3);
// We waited for 3 more blocks, expect best block to be number 4.
expect((await context.web3.eth.getBlock("latest")).number).to.equal(4);
// `finalized` block to be 2.
expect((await context.web3.eth.getBlock("finalized")).number).to.equal(2);
// `safe` block to be an alias of `finalized` in the Polkadot context.
expect((await context.web3.eth.getBlock("safe")).number).to.equal(2);
});
}
);

0 comments on commit 580a3ef

Please sign in to comment.