mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Remove finney and szabo denominations.
This commit is contained in:
committed by
Leonardo Alt
parent
cf189a3285
commit
38c6ecbbe2
@@ -45,13 +45,9 @@ using rational = boost::rational<bigint>;
|
||||
/// @NOTE This is not endian-specific; it's just a bunch of bytes.
|
||||
using Address = util::h160;
|
||||
|
||||
// The various denominations; here for ease of use where needed within code.
|
||||
static const u256 wei = 1;
|
||||
static const u256 shannon = u256("1000000000");
|
||||
static const u256 gwei = shannon;
|
||||
static const u256 szabo = shannon * 1000;
|
||||
static const u256 finney = szabo * 1000;
|
||||
static const u256 ether = finney * 1000;
|
||||
// The ether and gwei denominations; here for ease of use where needed within code.
|
||||
static const u256 gwei = u256(1) << 9;
|
||||
static const u256 ether = u256(1) << 18;
|
||||
|
||||
class ExecutionFramework
|
||||
{
|
||||
@@ -287,7 +283,7 @@ protected:
|
||||
bool m_transactionSuccessful = true;
|
||||
Address m_sender = account(0);
|
||||
Address m_contractAddress;
|
||||
u256 const m_gasPrice = 100 * szabo;
|
||||
u256 const m_gasPrice = 10 * gwei;
|
||||
u256 const m_gas = 100000000;
|
||||
bytes m_output;
|
||||
u256 m_gasUsed;
|
||||
|
||||
@@ -236,37 +236,6 @@ BOOST_AUTO_TEST_CASE(int_with_gwei_ether_subdenomination)
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(int_with_szabo_ether_subdenomination)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
function test () {
|
||||
uint x = 1 szabo;
|
||||
}
|
||||
}
|
||||
)";
|
||||
bytes code = compileFirstExpression(sourceCode);
|
||||
|
||||
bytes expectation({uint8_t(Instruction::PUSH5), 0xe8, 0xd4, 0xa5, 0x10, 0x00});
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(int_with_finney_ether_subdenomination)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract test {
|
||||
constructor()
|
||||
{
|
||||
uint x = 1 finney;
|
||||
}
|
||||
}
|
||||
)";
|
||||
bytes code = compileFirstExpression(sourceCode);
|
||||
|
||||
bytes expectation({uint8_t(Instruction::PUSH7), 0x3, 0x8d, 0x7e, 0xa4, 0xc6, 0x80, 0x00});
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(int_with_ether_ether_subdenomination)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
|
||||
@@ -428,11 +428,9 @@ BOOST_AUTO_TEST_CASE(comments_mixed_in_sequence)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ether_subdenominations)
|
||||
{
|
||||
Scanner scanner(CharStream("wei gwei szabo finney ether", ""));
|
||||
Scanner scanner(CharStream("wei gwei ether", ""));
|
||||
BOOST_CHECK_EQUAL(scanner.currentToken(), Token::SubWei);
|
||||
BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier);
|
||||
BOOST_CHECK_EQUAL(scanner.next(), Token::SubSzabo);
|
||||
BOOST_CHECK_EQUAL(scanner.next(), Token::SubFinney);
|
||||
BOOST_CHECK_EQUAL(scanner.next(), Token::SubEther);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
contract C {
|
||||
uint constant a = 1 wei + 2 szabo + 3 finney + 4 ether;
|
||||
uint constant a = 1 wei + 4 ether;
|
||||
uint constant b = 1 seconds + 2 minutes + 3 hours + 4 days + 5 weeks;
|
||||
uint constant c = 2 szabo / 1 seconds + 3 finney * 3 hours;
|
||||
uint constant d = 2 gwei / 1 seconds + 3 finney * 3 hours;
|
||||
uint constant c = 2 ether / 1 seconds + 3 gwei * 3 hours;
|
||||
uint constant d = 2 gwei / 1 seconds + 3 minutes * 3 hours;
|
||||
}
|
||||
// ----
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() {
|
||||
uint x = 1 finney;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (45-51): Expected ';' but got identifier
|
||||
@@ -0,0 +1,6 @@
|
||||
contract C {
|
||||
function f(uint finney) public pure returns (uint szabo) {
|
||||
// These used to be denominations.
|
||||
szabo = finney;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() {
|
||||
uint x = 1 szabo;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (45-50): Expected ';' but got identifier
|
||||
+2
-6
@@ -2,15 +2,11 @@ contract C {
|
||||
function f() public
|
||||
{
|
||||
a = 1 wei;
|
||||
b = 2 szabo;
|
||||
c = 3 finney;
|
||||
d = 4 ether;
|
||||
e = 5 gwei;
|
||||
b = 2 ether;
|
||||
c = 3 gwei;
|
||||
}
|
||||
uint256 a;
|
||||
uint256 b;
|
||||
uint256 c;
|
||||
uint256 d;
|
||||
uint256 e;
|
||||
}
|
||||
// ----
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
contract c {
|
||||
constructor()
|
||||
{
|
||||
a = 1 wei * 100 wei + 7 szabo - 3;
|
||||
a = 1 wei * 100 wei + 7 gwei - 3;
|
||||
}
|
||||
uint256 a;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
" block.timestamp "
|
||||
" days "
|
||||
" ether "
|
||||
" finney "
|
||||
" gasleft() "
|
||||
" gwei "
|
||||
" hours "
|
||||
@@ -18,7 +17,6 @@
|
||||
" msg.value "
|
||||
" now "
|
||||
" seconds "
|
||||
" szabo "
|
||||
" tx.gasprice "
|
||||
" tx.origin "
|
||||
" weeks "
|
||||
|
||||
Reference in New Issue
Block a user