Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
tests: add eip1559 solidity test (#656)
Browse files Browse the repository at this point in the history
Co-authored-by: Federico Kunze Küllmer <[email protected]>
  • Loading branch information
yijiasu-crypto and fedekunze authored Oct 22, 2021
1 parent 1fe07ed commit 5ff2a2c
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 1 deletion.
16 changes: 16 additions & 0 deletions tests/solidity/suites/eip1559/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "eip1559",
"version": "1.0.0",
"license": "GPL-3.0-or-later",
"scripts": {
"test-ganache": "yarn truffle test",
"test-ethermint": "yarn truffle test --network ethermint"
},
"devDependencies": {
"truffle": "^5.4.14",
"truffle-assertions": "^0.9.2"
},
"dependencies": {
"@truffle/hdwallet-provider": "^1.5.1-alpha.1"
}
}
20 changes: 20 additions & 0 deletions tests/solidity/suites/eip1559/test/eip1559.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
contract('Transaction', async function(accounts) {

it('should send a transaction with EIP-1559 flag', async function() {
console.log(`Accounts: `, accounts);
console.log(web3.version);
const tx = await web3.eth.sendTransaction({
from: accounts[0],
to: !!accounts[1] ? accounts[1] : "0x0000000000000000000000000000000000000000",
value: '10000000',
gas: '21000',
type: "0x2",
common: {
hardfork: 'london'
}
});
console.log(tx);
assert.equal(tx.type, '0x2', 'Tx type should be 0x2');
});

});
19 changes: 19 additions & 0 deletions tests/solidity/suites/eip1559/truffle-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// const HDWalletProvider = require('@truffle/hdwallet-provider');

module.exports = {
networks: {
// Development network is just left as truffle's default settings
ethermint: {
host: "127.0.0.1", // Localhost (default: none)
port: 8545, // Standard Ethereum port (default: none)
network_id: "*", // Any network (default: none)
gas: 5000000, // Gas sent with each transaction
gasPrice: 1000000000, // 1 gwei (in wei)
},
},
compilers: {
solc: {
version: "0.5.17",
},
},
}
44 changes: 43 additions & 1 deletion tests/solidity/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2262,6 +2262,20 @@
ethereumjs-util "^6.1.0"
ethereumjs-wallet "^1.0.1"

"@truffle/hdwallet-provider@^1.5.1-alpha.1":
version "1.5.1-alpha.1"
resolved "https://registry.yarnpkg.com/@truffle/hdwallet-provider/-/hdwallet-provider-1.5.1-alpha.1.tgz#6afcfedb9577b7e14452d73b95f20fd38653c4d2"
integrity sha512-8GH+6I/eUBMcW6WwI1DgZZrSw6hnjesZK7ll1PnIxkaUkS4fYViODLjhQl3l7McqDmWQJj6P3CsDycG9hyLTvA==
dependencies:
"@ethereumjs/common" "^2.4.0"
"@ethereumjs/tx" "^3.3.0"
"@trufflesuite/web3-provider-engine" "15.0.13-2.beta"
eth-sig-util "^3.0.1"
ethereum-cryptography "^0.1.3"
ethereum-protocol "^1.0.1"
ethereumjs-util "^6.1.0"
ethereumjs-wallet "^1.0.1"

"@truffle/interface-adapter@^0.4.16":
version "0.4.24"
resolved "https://registry.yarnpkg.com/@truffle/interface-adapter/-/interface-adapter-0.4.24.tgz#5d6d4f10c756e967f19ac2ad1620d11d25c034bb"
Expand Down Expand Up @@ -2467,6 +2481,34 @@
xhr "^2.2.0"
xtend "^4.0.1"

"@trufflesuite/[email protected]":
version "15.0.13-2.beta"
resolved "https://registry.yarnpkg.com/@trufflesuite/web3-provider-engine/-/web3-provider-engine-15.0.13-2.beta.tgz#f37f8d438389dbb708dbd59d987531df7626a7b7"
integrity sha512-TdD8EbsvQt3xt7bYb0Nt2FXp7O7lVxLURt1KioUaqw5RR4CgdzwwlQuwx8pFzZe1pUZvo03c4tWKx+Kqn26azQ==
dependencies:
"@ethereumjs/tx" "^3.3.0"
"@trufflesuite/eth-json-rpc-filters" "^4.1.2-1"
"@trufflesuite/eth-json-rpc-infura" "^4.0.3-0"
"@trufflesuite/eth-json-rpc-middleware" "^4.4.2-1"
"@trufflesuite/eth-sig-util" "^1.4.2"
async "^2.5.0"
backoff "^2.5.0"
clone "^2.0.0"
cross-fetch "^2.1.0"
eth-block-tracker "^4.4.2"
eth-json-rpc-errors "^2.0.2"
ethereumjs-block "^1.2.2"
ethereumjs-util "^5.1.5"
ethereumjs-vm "^2.3.4"
json-stable-stringify "^1.0.1"
promise-to-callback "^1.0.0"
readable-stream "^2.2.9"
request "^2.85.0"
semaphore "^1.0.3"
ws "^5.1.1"
xhr "^2.2.0"
xtend "^4.0.1"

"@types/accepts@*", "@types/accepts@^1.3.5":
version "1.3.5"
resolved "https://registry.yarnpkg.com/@types/accepts/-/accepts-1.3.5.tgz#c34bec115cfc746e04fe5a059df4ce7e7b391575"
Expand Down Expand Up @@ -14661,7 +14703,7 @@ truffle-assertions@^0.9.2:
assertion-error "^1.1.0"
lodash.isequal "^4.5.0"

[email protected]:
[email protected], truffle@^5.4.14:
version "5.4.14"
resolved "https://registry.yarnpkg.com/truffle/-/truffle-5.4.14.tgz#ecc9d263e15f98fc9e7736c34800a161729b25b9"
integrity sha512-upCCheE1H/p4AV7suISyJ45HnPgolnXEHVMqonRsbiNn9aKpmyrhNqF5grtMC95B1AVV9TtccKCCTozxkL/9Mg==
Expand Down

0 comments on commit 5ff2a2c

Please sign in to comment.