mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Some more base fees.
This commit is contained in:
parent
23b16a1e20
commit
90c4623460
@ -126,6 +126,7 @@ struct EVMBuiltins
|
|||||||
static auto constexpr GASLIMIT = PatternGenerator<Instruction::GASLIMIT>{};
|
static auto constexpr GASLIMIT = PatternGenerator<Instruction::GASLIMIT>{};
|
||||||
static auto constexpr CHAINID = PatternGenerator<Instruction::CHAINID>{};
|
static auto constexpr CHAINID = PatternGenerator<Instruction::CHAINID>{};
|
||||||
static auto constexpr SELFBALANCE = PatternGenerator<Instruction::SELFBALANCE>{};
|
static auto constexpr SELFBALANCE = PatternGenerator<Instruction::SELFBALANCE>{};
|
||||||
|
static auto constexpr BASEFEE = PatternGenerator<Instruction::BASEFEE>{};
|
||||||
static auto constexpr POP = PatternGenerator<Instruction::POP>{};
|
static auto constexpr POP = PatternGenerator<Instruction::POP>{};
|
||||||
static auto constexpr MLOAD = PatternGenerator<Instruction::MLOAD>{};
|
static auto constexpr MLOAD = PatternGenerator<Instruction::MLOAD>{};
|
||||||
static auto constexpr MSTORE = PatternGenerator<Instruction::MSTORE>{};
|
static auto constexpr MSTORE = PatternGenerator<Instruction::MSTORE>{};
|
||||||
|
@ -518,6 +518,7 @@ bool Predicate::fillArray(smtutil::Expression const& _expr, vector<string>& _arr
|
|||||||
map<string, optional<string>> Predicate::readTxVars(smtutil::Expression const& _tx) const
|
map<string, optional<string>> Predicate::readTxVars(smtutil::Expression const& _tx) const
|
||||||
{
|
{
|
||||||
map<string, Type const*> const txVars{
|
map<string, Type const*> const txVars{
|
||||||
|
{"block.basefee", TypeProvider::uint256()},
|
||||||
{"block.chainid", TypeProvider::uint256()},
|
{"block.chainid", TypeProvider::uint256()},
|
||||||
{"block.coinbase", TypeProvider::address()},
|
{"block.coinbase", TypeProvider::address()},
|
||||||
{"block.difficulty", TypeProvider::uint256()},
|
{"block.difficulty", TypeProvider::uint256()},
|
||||||
|
@ -128,7 +128,9 @@ smtutil::Expression SymbolicState::txMember(string const& _member) const
|
|||||||
|
|
||||||
smtutil::Expression SymbolicState::txTypeConstraints() const
|
smtutil::Expression SymbolicState::txTypeConstraints() const
|
||||||
{
|
{
|
||||||
return smt::symbolicUnknownConstraints(m_tx.member("block.chainid"), TypeProvider::uint256()) &&
|
return
|
||||||
|
smt::symbolicUnknownConstraints(m_tx.member("block.basefee"), TypeProvider::uint256()) &&
|
||||||
|
smt::symbolicUnknownConstraints(m_tx.member("block.chainid"), TypeProvider::uint256()) &&
|
||||||
smt::symbolicUnknownConstraints(m_tx.member("block.coinbase"), TypeProvider::address()) &&
|
smt::symbolicUnknownConstraints(m_tx.member("block.coinbase"), TypeProvider::address()) &&
|
||||||
smt::symbolicUnknownConstraints(m_tx.member("block.difficulty"), TypeProvider::uint256()) &&
|
smt::symbolicUnknownConstraints(m_tx.member("block.difficulty"), TypeProvider::uint256()) &&
|
||||||
smt::symbolicUnknownConstraints(m_tx.member("block.gaslimit"), TypeProvider::uint256()) &&
|
smt::symbolicUnknownConstraints(m_tx.member("block.gaslimit"), TypeProvider::uint256()) &&
|
||||||
|
@ -65,6 +65,7 @@ private:
|
|||||||
* - TODO: potentially storage of contracts
|
* - TODO: potentially storage of contracts
|
||||||
* - block and transaction properties, represented as a tuple of:
|
* - block and transaction properties, represented as a tuple of:
|
||||||
* - blockhash
|
* - blockhash
|
||||||
|
* - block basefee
|
||||||
* - block chainid
|
* - block chainid
|
||||||
* - block coinbase
|
* - block coinbase
|
||||||
* - block difficulty
|
* - block difficulty
|
||||||
@ -191,6 +192,7 @@ private:
|
|||||||
BlockchainVariable m_tx{
|
BlockchainVariable m_tx{
|
||||||
"tx",
|
"tx",
|
||||||
{
|
{
|
||||||
|
{"block.basefee", smtutil::SortProvider::uintSort},
|
||||||
{"block.chainid", smtutil::SortProvider::uintSort},
|
{"block.chainid", smtutil::SortProvider::uintSort},
|
||||||
{"block.coinbase", smt::smtSort(*TypeProvider::address())},
|
{"block.coinbase", smt::smtSort(*TypeProvider::address())},
|
||||||
{"block.difficulty", smtutil::SortProvider::uintSort},
|
{"block.difficulty", smtutil::SortProvider::uintSort},
|
||||||
|
@ -190,6 +190,7 @@ void WasmDialect::addExternals()
|
|||||||
static vector<External> externals{
|
static vector<External> externals{
|
||||||
{"eth", "getAddress", {i32ptr}, {}},
|
{"eth", "getAddress", {i32ptr}, {}},
|
||||||
{"eth", "getExternalBalance", {i32ptr, i32ptr}, {}},
|
{"eth", "getExternalBalance", {i32ptr, i32ptr}, {}},
|
||||||
|
{"eth", "getBlockBaseFee", {i32ptr}, {}},
|
||||||
{"eth", "getBlockHash", {i64, i32ptr}, {i32}},
|
{"eth", "getBlockHash", {i64, i32ptr}, {i32}},
|
||||||
{"eth", "call", {i64, i32ptr, i32ptr, i32ptr, i32}, {i32}},
|
{"eth", "call", {i64, i32ptr, i32ptr, i32ptr, i32}, {i32}},
|
||||||
{"eth", "callDataCopy", {i32ptr, i32, i32}, {}},
|
{"eth", "callDataCopy", {i32ptr, i32, i32}, {}},
|
||||||
|
@ -1854,6 +1854,7 @@ BOOST_AUTO_TEST_CASE(builtins)
|
|||||||
abi.encodePacked;
|
abi.encodePacked;
|
||||||
abi.encodeWithSelector;
|
abi.encodeWithSelector;
|
||||||
abi.encodeWithSignature;
|
abi.encodeWithSignature;
|
||||||
|
block.basefee;
|
||||||
block.chainid;
|
block.chainid;
|
||||||
block.coinbase;
|
block.coinbase;
|
||||||
block.difficulty;
|
block.difficulty;
|
||||||
|
@ -413,6 +413,11 @@ u256 EwasmBuiltinInterpreter::evalEthBuiltin(string const& _fun, vector<uint64_t
|
|||||||
writeAddress(arg[3], h160(0xcccccc + arg[1]));
|
writeAddress(arg[3], h160(0xcccccc + arg[1]));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
else if (_fun == "getBlockBaseFee")
|
||||||
|
{
|
||||||
|
writeU128(arg[0], m_state.basefee);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
else if (_fun == "getBlockDifficulty")
|
else if (_fun == "getBlockDifficulty")
|
||||||
{
|
{
|
||||||
writeU256(arg[0], m_state.difficulty);
|
writeU256(arg[0], m_state.difficulty);
|
||||||
|
Loading…
Reference in New Issue
Block a user