foundry icon indicating copy to clipboard operation
foundry copied to clipboard

Bug: forge create / cast send try to use eth_createAccessList when not requested. Breaks wallet usage

Open sambacha opened this issue 2 years ago • 5 comments

Component

Forge, Cast

Have you ensured that all of these are up to date?

  • [X] Foundry
  • [X] Foundryup

What version of Foundry are you on?

forge 0.2.0 (3c49efe 2022-07-14T00:05:10.018576Z)

What command(s) is the bug in?

forge create / cast send

Operating System

macOS (Intel)

Describe the bug

First, metamask does not expose eth_createAccessList, nor does any wallet that I know of actually. I do not know why this method is being requested actually

[0]   id: 0.2967492394987894,
[0]   type: 'provider',
[0]   payload: {
[0]     id: 5,
[0]     jsonrpc: '2.0',
[0]     method: 'eth_createAccessList',
[0]     params: [ [Object], 'latest' ]
[0]   }
[0] }

I am doing

cast send --cast-async --rpc-url $ETH_RPC_URL --from $ETH_FROM --to $ETH_FROM --legacy
forge create --rpc-url $ETH_RPC_URL --from 0xE3f0bbdc86680Cb414B327cb427395e611C77793 Hello

I get these errors:

Alternatively, if you're using a local node with unlocked accounts, set the `ETH_FROM` environment variable to the address of the account you want to use
ProviderError(JsonRpcError(JsonRpcError { code: -32603, message: "Cannot read properties of undefined (reading 'message')", data: Some(Object({"originalError": Object({})})) }))

ProviderError(JsonRpcError(JsonRpcError { code: -32000, message: "gas required exceeds allowance (0)", data: None }))
  1. why is foundry using eth_createAccessList ?
  2. Why can I not load my address from ETH_FROM when using forge?
  3. what happened to cast

For reference, here is the interface for using metamask and foundry, working.

sambacha avatar Jul 15 '22 09:07 sambacha

why is foundry using eth_createAccessList ?

I think this is baked into ethers-rs how transactions are filled before sending:

https://github.com/gakonst/ethers-rs/blob/42e966662a42aaa1ad765550ab404e19cbf53087/ethers-providers/src/provider.rs#L356-L357

and Eip1559TransactionRequest has an empty access list by default,

https://github.com/gakonst/ethers-rs/blob/0abc3ca39ae54fc11a7541da9e92bbebfe51c899/ethers-core/src/types/transaction/eip1559.rs#L53

so it will always be set...

not sure what do to here @gakonst , we could make the accessList of Eip1559TransactionRequest optional

  1. Why can I not load my address from ETH_FROM when using forge?

I think that's just missing in the forge create, need to check

3.what happened to cast

wdym?

mattsse avatar Jul 15 '22 12:07 mattsse

why is foundry using eth_createAccessList ?

I think this is baked into ethers-rs how transactions are filled before sending:

gakonst/ethers-rs@42e9666/ethers-providers/src/provider.rs#L356-L357

and Eip1559TransactionRequest has an empty access list by default,

gakonst/ethers-rs@0abc3ca/ethers-core/src/types/transaction/eip1559.rs#L53

so it will always be set...

not sure what do to here @gakonst , we could make the accessList of Eip1559TransactionRequest optional

  1. Why can I not load my address from ETH_FROM when using forge?

I think that's just missing in the forge create, need to check

3.what happened to cast

wdym?

thanks for clarifying, accessList is only useful if your going to use 24 storage keys as that is what is needed to break even I am pretty sure.

  1. Awesome , lmk so I can finish this tutorial for using metamask and foundry. this is the dashboard repo for reference: https://github.com/manifoldfinance/walletbus if you want just clone and ./setup to bring up the interface locally. the RPC info is echo'd in the shell

  2. you use to be able to do something like this was it not possible?

HELLO=$(cast send --create $(<Hello.bin))
cast call $HELLO "hi()(string)"

sambacha avatar Jul 15 '22 13:07 sambacha

re 3.

I'm actually not sure this was supported, or removed in favor of forge create

what would be the data/ content of Hello.bin in:

cast send --create <data>

code + args?

mattsse avatar Jul 15 '22 13:07 mattsse

re 3.

I'm actually not sure this was supported, or removed in favor of forge create

what would be the data/ content of Hello.bin in:

cast send --create <data>

code + args?

from dapptools example:

export ETH_RPC_URL=https://mainnet.infura.io/v3/$YOUR_API_KEY
export ETH_FROM=$YOUR_ADDRESS
echo 'contract Hello { function hi() public pure returns(string memory) {return "Hello, World!";}}' | solc --bin -o . --overwrite -
HELLO=$(seth send --create $(<Hello.bin))
seth call $HELLO "hi()(string)"

sambacha avatar Jul 16 '22 04:07 sambacha

Still current as of latest release

sambacha avatar Aug 05 '22 20:08 sambacha

this should no longer be the case now, per #2839

mattsse avatar Aug 22 '22 12:08 mattsse

this should no longer be the case now, per #2839

thank you

sambacha avatar Aug 24 '22 21:08 sambacha