solidity
solidity copied to clipboard
Add VM Version Paris and new built in function ``prevrandao``
fixes #13512
I've done a bit of grepping, and it seems like you're missing a case in libevmasm/SemanticInformation.cpp in invalidInPureFunction(Instruction _instructioN). If DIFFICULTY was invalid there, then surely PREVRANDAO is?
Also in test/tools/yulInterpreter/EVMInstructionInterpreter.cpp, and test/tools/ossfuzz/protoToYul.cpp, but those are tools, so maybe not relevant to this PR.
seems like you're missing a case in libevmasm/SemanticInformation.cpp
They both have the same value, so it can only contain either DIFFICULTY or PREVRANDAO, in that switch case i decided to leave the original one.
...
same with the other cases, all switches just use the number and the semantics didn't really change. Whether we want to update the yul interpreter m_state.difficulty part is a different question, but nothing breaks if we keep it like this.
Not quiet sure why the grammar test fails:
[1907/2991] Testing /root/project/test/libsolidity/semanticTests/inlineAssembly/prevrandao_pre-paris_function.sol FAILED
line 4:16 no viable alternative at input 'letprevrandao'
line 4:27 mismatched input ':=' expecting YulLParen
line 6:8 mismatched input '}' expecting YulLParen
line 10:21 mismatched input 'prevrandao' expecting YulIdentifier
line 10:34 extraneous input '->' expecting {YulBreak, YulContinue, YulFor, YulFunction, YulIf, 'leave', 'let', 'switch', YulEVMBuiltin, YulLBrace, YulRBrace, YulIdentifier}
Exited with code exit status 1
found an exception in the grammar test for let basefee... and added one as well for let prevrandao
This issue solves #13517 as well, right? Should be added to the top comment.
This issue solves https://github.com/ethereum/solidity/issues/13517 as well, right? Should be added to the top comment.
It should. But just to note, this PR hasn't made Paris the default.
It should. But just to note, this PR hasn't made Paris the default.
If that is desired I can change that, no problem :)
There was an error when running chk_coding_style for commit 1228b043036d68149a94d1e2547f7cc5b09ad626:
Coding style error:
libevmasm/Instruction.h:295: InstructionInfo(
libevmasm/Instruction.h:296: std::string _name,
libevmasm/Instruction.h:297: int _additional,
libevmasm/Instruction.h:298: int _args,
libevmasm/Instruction.h:299: int _ret,
libevmasm/Instruction.h:300: bool _sideEffects,
libevmasm/Instruction.h:301: Tier _gasPriceTier
libevmasm/Instruction.h:302: ):
libevmasm/Instruction.h:303: m_name(_name),
libevmasm/Instruction.h:304: additional(_additional),
libevmasm/Instruction.h:305: args(_args),
libevmasm/Instruction.h:306: ret(_ret),
libevmasm/Instruction.h:307: sideEffects(_sideEffects),
libevmasm/Instruction.h:308: gasPriceTier(_gasPriceTier)
libevmasm/Instruction.h:309: {}
libsolidity/interface/CompilerStack.cpp:227: if (m_evmVersion < langutil::EVMVersion::paris())
libsolidity/interface/CompilerStack.cpp:228: solidity::evmasm::usePreParisOpcodeNames();
Please check that your changes are working as intended.
There was an error when running chk_coding_style for commit 513d5a32658127eb4afa44b45cff526a36e87e30:
Coding style error:
libevmasm/Disassemble.cpp:19:#include "libevmasm/Instruction.h"
libevmasm/Disassemble.cpp:20:#include "liblangutil/EVMVersion.h"
libevmasm/Disassemble.h:21:#include "liblangutil/EVMVersion.h"
libsolidity/interface/StandardCompiler.cpp:24:#include "libevmasm/Instruction.h"
libyul/AsmAnalysis.cpp:22:#include "libevmasm/Instruction.h"
Please check that your changes are working as intended.
I tried to keep my automatic Search & Replace in that commit.
Tests & style are not yet updated, probably some broken due to the rename.
This pull request is stale because it has been open for 14 days with no activity.
It will be closed in 7 days unless the stale label is removed.
Closing this as it will be superseded by https://github.com/ethereum/solidity/pull/13759. Will keep the branch around as reference for now.