Skip to content
This repository was archived by the owner on Mar 13, 2023. It is now read-only.

Commit 81fb0c5

Browse files
Fix transfer gas price (#549)
* Inc gas price * Fix tests
1 parent 81e30e6 commit 81fb0c5

File tree

6 files changed

+14
-20
lines changed

6 files changed

+14
-20
lines changed

bin/node/cli/src/chain_spec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ pub fn pangolin_development_config() -> PangolinChainSpec {
255255
*account_id,
256256
GenesisAccount {
257257
nonce: 0.into(),
258-
balance: 123_456_789_000_000_000_090u128.into(),
258+
balance: 123_456_789_000_000_000_000_090u128.into(),
259259
storage: BTreeMap::new(),
260260
code: vec![],
261261
},

bin/node/runtime/pangolin/src/evm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ use darwinia_evm::{
88
use darwinia_evm_precompile::DarwiniaPrecompiles;
99
use dvm_ethereum::account_basic::DVMAccountBasicMapping;
1010

11-
/// Fixed gas price of `1`.
11+
/// Fixed gas price.
1212
pub struct FixedGasPrice;
1313
impl FeeCalculator for FixedGasPrice {
1414
fn min_gas_price() -> U256 {
1515
// Gas price is always one token per gas.
16-
1.into()
16+
1_000_000_000.into()
1717
}
1818
}
1919
frame_support::parameter_types! {

script_tests/tests/1_test-transfer.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe("Test Transfer Balance", function () {
1717
const balanceFrom = web3.utils.fromWei(await web3.eth.getBalance(addressFrom), "ether");
1818
const balanceTo = await web3.utils.fromWei(await web3.eth.getBalance(addressTo), "ether");
1919

20-
expect(balanceFrom).to.be.equal("123.45678900000000009");
20+
expect(balanceFrom).to.be.equal("123456.78900000000000009");
2121
expect(balanceTo).to.be.equal("0");
2222
expect(await web3.eth.getTransactionCount(addressFrom, "latest")).to.eq(0);
2323
expect(await web3.eth.getTransactionCount(addressFrom, "earliest")).to.eq(0);
@@ -30,7 +30,6 @@ describe("Test Transfer Balance", function () {
3030
to: addressTo,
3131
value: web3.utils.toWei("10", "ether"),
3232
gas: "5000000000",
33-
gas_price: 1,
3433
},
3534
privKey
3635
);
@@ -40,15 +39,15 @@ describe("Test Transfer Balance", function () {
4039
);
4140

4241
expect(createReceipt.transactionHash).to.be.equal(
43-
"0x820524e7e2797a1b231f06b66049de173e1e09a6b61c1ee1373434b41fb29554"
42+
"0x040ef42bccbfa1af89c37d747f94d78465d7630d4c974436e55f36338f651327"
4443
);
4544
}).timeout(10000);
4645

4746
it("Check balance after transfer 10 ether", async function () {
4847
const balanceFrom = web3.utils.fromWei(await web3.eth.getBalance(addressFrom), "ether");
4948
const balanceTo = await web3.utils.fromWei(await web3.eth.getBalance(addressTo), "ether");
5049

51-
expect(balanceFrom).to.be.equal("113.45678899999997909");
50+
expect(balanceFrom).to.be.equal("123446.78897900000000009");
5251
expect(balanceTo).to.be.equal("10");
5352
expect(await web3.eth.getTransactionCount(addressFrom, "latest")).to.eq(1);
5453
});
@@ -60,7 +59,6 @@ describe("Test Transfer Balance", function () {
6059
to: addressTo2,
6160
value: web3.utils.toWei("100", "wei"),
6261
gas: "5000000000",
63-
gas_price: 1,
6462
},
6563
privKey
6664
);
@@ -73,7 +71,7 @@ describe("Test Transfer Balance", function () {
7371
const balanceFrom = web3.utils.fromWei(await web3.eth.getBalance(addressFrom), "ether");
7472
const balanceTo = await web3.utils.fromWei(await web3.eth.getBalance(addressTo2), "ether");
7573

76-
expect(balanceFrom).to.be.equal("113.45678899999995799");
74+
expect(balanceFrom).to.be.equal("123446.78895799999999999");
7775
expect(balanceTo).to.be.equal("0.0000000000000001");
7876
expect(await web3.eth.getTransactionCount(addressFrom, "latest")).to.eq(2);
7977
});
@@ -85,7 +83,6 @@ describe("Test Transfer Balance", function () {
8583
to: addressTo,
8684
value: web3.utils.toWei("50", "ether"),
8785
gas: "5000000000",
88-
gas_price: 1,
8986
},
9087
privKey
9188
);
@@ -95,15 +92,15 @@ describe("Test Transfer Balance", function () {
9592
);
9693

9794
expect(createReceipt.transactionHash).to.be.equal(
98-
"0x90febfff3a70204babfa857cb9baa9664badf56f826e696335ef12135d06a89f"
95+
"0x0046e4a4c8bee087c2ef25ce9b3717eaf5dcd53c6eb6815cc8e887abc667c371"
9996
);
10097
}).timeout(10000);
10198

10299
it("Check balance after transfer 50 ether", async function () {
103100
const balanceFrom = web3.utils.fromWei(await web3.eth.getBalance(addressFrom), "ether");
104101
const balanceTo = await web3.utils.fromWei(await web3.eth.getBalance(addressTo), "ether");
105102

106-
expect(balanceFrom).to.be.equal("63.45678899999993699");
103+
expect(balanceFrom).to.be.equal("123396.78893699999999999");
107104
expect(balanceTo).to.be.equal("60");
108105
expect(await web3.eth.getTransactionCount(addressFrom, "latest")).to.eq(3);
109106
});
@@ -124,13 +121,13 @@ describe("Test Transfer Balance", function () {
124121
createTransaction.rawTransaction
125122
);
126123
expect(createReceipt.transactionHash).to.be.equal(
127-
"0x93b9bc903778f59d124da6ee112b0a5728ab911d00ea198788670be699dec4bf"
124+
"0x2accb0157682d1ed3497aeb7056704e856da4842ceefe9c838fc990b802c5beb"
128125
);
129126
}).timeout(10000);
130127

131128
it("Check balance after transfer self", async function () {
132129
const balanceFrom = web3.utils.fromWei(await web3.eth.getBalance(addressFrom), "ether");
133-
expect(balanceFrom).to.be.equal("63.45678899999991599");
130+
expect(balanceFrom).to.be.equal("123396.78891599999999999");
134131
expect(await web3.eth.getTransactionCount(addressFrom, "latest")).to.eq(4);
135132
});
136133

@@ -144,7 +141,6 @@ describe("Test Transfer Balance", function () {
144141
gas: "5000000000",
145142
data: input,
146143
value: web3.utils.toWei("30", "ether"),
147-
gas_price: 1,
148144
},
149145
privKey
150146
);
@@ -155,7 +151,7 @@ describe("Test Transfer Balance", function () {
155151

156152
it("Get sender balance after withdraw", async function () {
157153
const balanceFrom = web3.utils.fromWei(await web3.eth.getBalance(addressFrom), "ether");
158-
expect(balanceFrom).to.be.equal("33.456788999999884478");
154+
expect(balanceFrom).to.be.equal("123366.78888448799999999");
159155
expect(await web3.eth.getTransactionCount(addressFrom, "latest")).to.eq(5);
160156
});
161157
});

script_tests/tests/test-bloom.js

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

script_tests/tests/test-gas.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ describe("Test gas", function () {
3434
it("eth_estimateGas for contract call", async function () {
3535
const contract = new web3.eth.Contract([TEST_CONTRACT_ABI], FIRST_CONTRACT_ADDRESS, {
3636
from: addressFrom,
37-
gasPrice: "0x01",
3837
});
3938

4039
expect(await contract.methods.multiply(3).estimateGas()).to.equal(21204);

script_tests/tests/test-rpc-constants.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ describe("Test RPC Constants", function () {
2626
expect(block.author).to.equal("0x15fdd31c61141abd04a99fd6822c8558854ccde3");
2727
});
2828

29-
it("should gas price is 0x0", async function () {
30-
expect(await web3.eth.getGasPrice()).to.equal("1");
29+
it("should gas price", async function () {
30+
expect(await web3.eth.getGasPrice()).to.equal("1000000000");
3131
});
3232

3333
it("should protocal version is 1", async function () {

0 commit comments

Comments
 (0)