Adds EIP-2935 HISTORY_STORAGE contract support#1618
Conversation
Introduces a historical block hash contract with a fixed address per EIP-2935, enabling dApps using the EIP-2935 convention to function seamlessly. Loads the contract code at the fork activation block to ensure compatibility and interoperability.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
otherview
left a comment
There was a problem hiding this comment.
Might be worth adding structs and tests in the thorclient/builtin package too.
Remove test.Short()
| // builtin.Extension.Address == thor.BytesToAddress([]byte("Extension")) | ||
| address constant EXTENSION = 0x0000000000000000000000457874656E73696F6e; | ||
|
|
||
| fallback(bytes calldata input) external returns (bytes memory) { |
There was a problem hiding this comment.
Yes, at the end of function , it will return bytes32 data.
There was a problem hiding this comment.
ooc, why do we need the assembly ?
There was a problem hiding this comment.
It's equivalent this:
return abi.encodePacked(_Extension(EXTENSION).blockID(num));
Assembly is used because it is more concise.
2. Change SERVE_WINDOW -> HISTORY_SERVE_WINDOW
| // builtin.Extension.Address == thor.BytesToAddress([]byte("Extension")) | ||
| address constant EXTENSION = 0x0000000000000000000000457874656E73696F6e; | ||
|
|
||
| fallback(bytes calldata input) external returns (bytes memory) { |
There was a problem hiding this comment.
Should this be a view ?
| fallback(bytes calldata input) external returns (bytes memory) { | |
| fallback(bytes calldata input) external view returns (bytes memory) { |
There was a problem hiding this comment.
It can't set 'view', the fallback method only could be set 'payable' or 'non-payable', default is 'non-payable'.
Description
Introduces a historical block hash contract with a fixed address per EIP-2935, enabling dApps using the EIP-2935 convention to function seamlessly. Loads the contract code at the fork activation block to ensure compatibility and interoperability.
The different with Ethereum
Getlogic, redirect to the executor builtin contract.Fixes # (issue)
Type of change
Checklist: