Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: target shanghai #133

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
out = 'out'
libs = ['lib']
ffi = true
evm_version = "shanghai"
Copy link
Contributor

@obatirou obatirou Jul 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are still running in 0.8.15, wouldn't this need to be 0.8.19 as it is minimum supported solidity version for shanghai ?

Link to CI
Capture d’écran 2023-07-12 à 11 05 21

Some tests files have fixed pragma set to 0.8.15 and should be easily fixable.
One problem is that huffmate depends on solmate and more precisely do an import:
import { ERC1155Recipient } from "solmate/test/ERC1155.t.sol";
which also have a fixed pragma.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we need a quick PR in Solmate (I don't think that this is so much work)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the PR for solmate transmissions11/solmate#382

fs_permissions = [
{ access = "read", path = "./test/auth/mocks/AuthWrappers.huff" },
{ access = "read", path = "./test/auth/mocks/OwnedWrappers.huff" },
Expand Down
2 changes: 1 addition & 1 deletion src/tokens/ERC20.huff
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
[INITIAL_DOMAIN_SEPARATOR] sstore // []

// Copy the runtime bytecode with constructor argument concatenated.
0x67 // [offset] - constructor code size
0x66 // [offset] - constructor code size
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
0x66 // [offset] - constructor code size
__codesize(CONSTRUCTOR) // [offset] - constructor code size

still not perfect but better than hardcoded

dup1 // [offset, offset]
codesize // [total_size, offset, offset]
sub // [runtime_size, offset]
Expand Down
1 change: 0 additions & 1 deletion src/utils/JumpTableUtil.huff
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/// @title JumpTableUtil
/// @notice SPDX-License-Identifier: MIT
/// @author clabby <https://github.com/clabby>
Expand Down
1 change: 1 addition & 0 deletions test/tokens/ERC20.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ contract ERC20Test is Test {

// Deploy the Mintable ERC20
address mintableTokenAddress = HuffDeployer.config()
.with_evm_version("shanghai")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems to be the default (src). You want to do this to avoid future issues ?

.with_code(mintable_wrapper)
.with_deployer(deployer)
.with_args(bytes.concat(abi.encode("Token"), abi.encode("TKN"), abi.encode(DECIMALS)))
Expand Down
4 changes: 2 additions & 2 deletions test/utils/JumpTableUtil.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ interface IJumpTableUtil {
}

contract JumpTableUtilTest is Test {
uint constant FIRST_LABEL_PC = 147;
uint constant FIRST_LABEL_PC = 141;

IJumpTableUtil jtUtil;

function setUp() public {
/// @notice deploy a new instance of IJumpTableUtil by
/// passing in the address of the deployed Huff contract
string memory wrapper_code = vm.readFile("test/utils/mocks/JumpTableUtilWrappers.huff");
jtUtil = IJumpTableUtil(HuffDeployer.deploy_with_code("utils/JumpTableUtil", wrapper_code));
jtUtil = IJumpTableUtil(HuffDeployer.config().with_evm_version("shanghai").with_code(wrapper_code).deploy("utils/JumpTableUtil"));
}

function testGetJumpdestFromJT_Mem() public {
Expand Down