Skip to content

Commit

Permalink
Merge branch 'dcmt/linea'
Browse files Browse the repository at this point in the history
  • Loading branch information
duncancmt committed Jul 18, 2024
2 parents 35a9576 + e1397e9 commit ecd28b3
Show file tree
Hide file tree
Showing 17 changed files with 320 additions and 120 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ Master list of UniV3 forks:
10. BladeSwap (Algebra-like)
11. Fenix (Algebra-like)
12. ZebraV3
13. Lynex (Algebra-like)

---

* Deployed Settler to Linea
* Added Lynex Algebra-style UniV3 fork to Linea
* Update Velodrome Slipstream factory address (and inithash) to migrated one

## 2024-07-15
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1038,8 +1038,10 @@ like deploying a new `Settler`. `0x1CeC01DC0fFEE5eB5aF47DbEc1809F2A7c601C30`
(ice cold coffees) is the address of the pauser contract. It's at the same
address on all chains unless somebody screwed up the vanity addresses and didn't
update this document. On Linea, the address of the pauser contract is
`0x2F01FA51F49526da65E70A60EFDDD8e12077D120` because whoever did their EVM
compatibility documentation documented the opposite of the truth 🤬.
`0xBE71A746C7AE0f9D18E6DB4f71d09732B0Ee5b9c` because whoever did their EVM
compatibility documentation documented the opposite of the truth 🤬. When Linea
adopts the Shanghai hardfork (`PUSH0`), remove the preceeding sentence from this
document.

0. Go to that address on the relevant block explorer.

Expand Down
6 changes: 4 additions & 2 deletions chain_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,12 @@
},
"governance": {
"upgradeSafe": "0xf36b9f50E59870A24F42F9Ba43b2aD0A4b8f2F51",
"deploymentSafe": "0x8E5DE7118a596E99B0563D3022039c11927f4827"
"deploymentSafe": "0x8E5DE7118a596E99B0563D3022039c11927f4827",
"pause": "0xBE71A746C7AE0f9D18E6DB4f71d09732B0Ee5b9c"
},
"deployment": {
"allowanceHolder": "VANITY ADDRESS IS BURNED"
"deployer": "0x00000000000004533Fe15556B1E086BB1A72cEae",
"allowanceHolder": "0x000000000000175a8b9bC6d539B3708EEd92EA6c"
},
"etherscanApi": "https://api.lineascan.build/api"
},
Expand Down
5 changes: 5 additions & 0 deletions secrets.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,10 @@
"address": "0x0000000000005E88410CcDFaDe4a5EfaE4b49562",
"deployer": "0x4f05532AD8c7C87C22Bd793661DB6A174e09cbb5",
"key": ""
},
"allowanceHolderLondon": {
"address": "0x000000000000175a8b9bC6d539B3708EEd92EA6c",
"deployer": "0x5c50b56D83Db01245d4B7db9eAc9199c9CdbAEE1",
"key": ""
}
}
6 changes: 5 additions & 1 deletion sh/address.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,11 @@ function create3 {
declare -r salt

# this is the "create3" shim inithash
declare -r inithash='0x3bf3f97f0be1e2c00023033eefeb4fc062ac552ff36778b17060d90b6764902f'
if [[ $(get_config isShanghai) != [Tt]rue ]] ; then
declare -r inithash='0x1774bbdc4a308eaf5967722c7a4708ea7a3097859cb8768a10611448c29981c3'
else
declare -r inithash='0x3bf3f97f0be1e2c00023033eefeb4fc062ac552ff36778b17060d90b6764902f'
fi

declare shim
shim="$(cast concat-hex 0xff "$factory" "$salt" "$inithash")"
Expand Down
63 changes: 0 additions & 63 deletions sh/common_safe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,75 +12,12 @@ declare deployer_address
deployer_address="$(get_config deployment.deployer)"
declare -r deployer_address

declare -r get_owners_sig='getOwners()(address[])'
declare owners
owners="$(cast abi-decode "$get_owners_sig" "$(cast call --rpc-url "$rpc_url" "$safe_address" "$(cast calldata "$get_owners_sig")")")"
owners="${owners:1:$((${#owners} - 2))}"
owners="${owners//, /;}"
declare -r owners

declare -r nonce_sig='nonce()(uint256)'
declare -i nonce
nonce="$(cast abi-decode "$nonce_sig" "$(cast call --rpc-url "$rpc_url" "$safe_address" "$(cast calldata "$nonce_sig")")")"
nonce=$((${SAFE_NONCE_INCREMENT:-0} + nonce))
declare -r -i nonce

declare -a owners_array
IFS=';' read -r -a owners_array <<<"$owners"
declare -r -a owners_array

PS3='Who are you?: '
declare signer
select signer in "${owners_array[@]}" ; do break ; done
declare -r signer

if [[ ${signer:-unset} = 'unset' ]] ; then
echo 'I do not know who that is' >&2
exit 1
fi

PS3='What kind of wallet are you using? '
declare wallet_type
select wallet_type in ledger trezor hot frame ; do break ; done
declare -r wallet_Type

if [[ ${wallet_type:-unset} = 'unset' ]] ; then
exit 1
fi

declare -a wallet_args
case $wallet_type in
'ledger')
wallet_args=(--ledger)
;;
'trezor')
wallet_args=(--trezor)
;;
'hot')
wallet_args=(--interactive)
;;
'frame')
wallet_args=(--unlocked)
;;
*)
echo 'Unrecognized wallet type: '"$wallet_type" >&2
exit 1
;;
esac

if [[ $wallet_type = 'ledger' ]] ; then
IFS='' read -r -e -p 'Ledger wallet HD path (BIP32) [default '"44'/60'/0'/0"']: '
if [[ ${REPLY:-unset} = 'unset' ]] ; then
wallet_args+=(
--mnemonic-derivation-path "44'/60'/0'/0"
)
else
wallet_args+=(
--mnemonic-derivation-path "$REPLY"
)
fi
fi

# calls encoded as operation (always zero) 1 byte
# target address 20 bytes
# value 32 bytes
Expand Down
22 changes: 22 additions & 0 deletions sh/common_safe_owner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
declare -r get_owners_sig='getOwners()(address[])'
declare owners
owners="$(cast abi-decode "$get_owners_sig" "$(cast call --rpc-url "$rpc_url" "$safe_address" "$(cast calldata "$get_owners_sig")")")"
owners="${owners:1:$((${#owners} - 2))}"
owners="${owners//, /;}"
declare -r owners

declare -a owners_array
IFS=';' read -r -a owners_array <<<"$owners"
declare -r -a owners_array

PS3='Who are you?: '
declare signer
select signer in "${owners_array[@]}" ; do break ; done
declare -r signer

echo "$signer" >&2

if [[ ${signer:-unset} = 'unset' ]] ; then
echo 'I do not know who that is' >&2
exit 1
fi
2 changes: 1 addition & 1 deletion sh/common_secrets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if [[ $(ls -l secrets.json | cut -d' ' -f1 | cut -d. -f1) != '-rw-------' ]] ; t
exit 1
fi

if ! sha256sum -c <<<'24290900be9575d1fb6349098b1c11615a2eac8091bc486bec6cf67239b7846a secrets.json' >/dev/null ; then
if ! sha256sum -c <<<'bb82de121880f1182dbae410b341749e5ac1355954ae6c03151a1826e7bba745 secrets.json' >/dev/null ; then
echo 'Secrets are wrong' >&2
exit 1
fi
Expand Down
41 changes: 41 additions & 0 deletions sh/common_wallet_type.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
PS3='What kind of wallet are you using? '
declare wallet_type
select wallet_type in ledger trezor hot frame ; do break ; done
declare -r wallet_Type

if [[ ${wallet_type:-unset} = 'unset' ]] ; then
exit 1
fi

declare -a wallet_args
case $wallet_type in
'ledger')
wallet_args=(--ledger)
;;
'trezor')
wallet_args=(--trezor)
;;
'hot')
wallet_args=(--interactive)
;;
'frame')
wallet_args=(--unlocked)
;;
*)
echo 'Unrecognized wallet type: '"$wallet_type" >&2
exit 1
;;
esac

if [[ $wallet_type = 'ledger' ]] ; then
IFS='' read -r -e -p 'Ledger wallet HD path (BIP32) [default '"44'/60'/0'/0"']: '
if [[ ${REPLY:-unset} = 'unset' ]] ; then
wallet_args+=(
--mnemonic-derivation-path "44'/60'/0'/0"
)
else
wallet_args+=(
--mnemonic-derivation-path "$REPLY"
)
fi
fi
2 changes: 2 additions & 0 deletions sh/confirm_new_feature.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ safe_address="$(get_config governance.upgradeSafe)"
declare -r safe_address

. "$project_root"/sh/common_safe.sh
. "$project_root"/sh/common_safe_owner.sh
. "$project_root"/sh/common_wallet_type.sh

declare -r -i feature="$1"
shift
Expand Down
17 changes: 16 additions & 1 deletion sh/confirm_new_settler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ safe_address="$(get_config governance.deploymentSafe)"
declare -r safe_address

. "$project_root"/sh/common_safe.sh
. "$project_root"/sh/common_safe_owner.sh
. "$project_root"/sh/common_wallet_type.sh
. "$project_root"/sh/common_deploy_settler.sh

declare deploy_calldata
Expand Down Expand Up @@ -168,6 +170,19 @@ else
fi
declare -r signature

declare safe_url
safe_url="$(get_config safe.apiUrl)"
declare -r safe_url

if [[ $safe_url = 'NOT SUPPORTED' ]] ; then
declare signature_file
signature_file="$project_root"/settler_confirmation_"$chain_display_name"_"$(git rev-parse --short HEAD)"_"$(tr '[:lower:]' '[:upper:]' <<<"$signer")".txt
declare -r signature_file
echo "$signature" >"$signature_file"
echo "Signature saved to '$signature_file'" >&2
exit 1
fi

declare signing_hash
signing_hash="$(eip712_hash "$deploy_calldata" 1)"
declare -r signing_hash
Expand Down Expand Up @@ -200,6 +215,6 @@ safe_multisig_transaction="$(
declare -r safe_multisig_transaction

# call the API
curl --fail -s "$(get_config safe.apiUrl)"'/v1/safes/'"$safe_address"'/multisig-transactions/' -X POST -H 'Content-Type: application/json' --data "$safe_multisig_transaction"
curl --fail -s "$safe_url"'/v1/safes/'"$safe_address"'/multisig-transactions/' -X POST -H 'Content-Type: application/json' --data "$safe_multisig_transaction"

echo 'Signature submitted' >&2
4 changes: 3 additions & 1 deletion sh/deploy_allowanceholder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ export FOUNDRY_OPTIMIZER_RUNS=1000000

forge clean
forge create --private-key "$(get_secret allowanceHolder key)" --chain "$(get_config chainId)" --rpc-url "$rpc_url" --gas-price "$gas_price" --gas-limit 4000000 --etherscan-api-key "$(get_api_secret etherscanKey)" --verifier-url "$(get_config etherscanApi)" --verify $(get_config extraFlags) src/allowanceholder/AllowanceHolder.sol:AllowanceHolder
forge verify-contract --watch --chain "$(get_config chainId)" --verifier sourcify --optimizer-runs 1000000 --constructor-args 0x "$(get_secret allowanceHolder address)" src/allowanceholder/AllowanceHolder.sol:AllowanceHolder
if (( chainid != 81457 )) && (( chainid != 59144 )) ; then # sourcify doesn't support Blast or Linea
forge verify-contract --watch --chain "$(get_config chainId)" --verifier sourcify --optimizer-runs 1000000 --constructor-args 0x "$(get_secret allowanceHolder address)" src/allowanceholder/AllowanceHolder.sol:AllowanceHolder
fi

echo 'Deployment is complete' >&2
echo 'Add the following to your chain_config.json' >&2
Expand Down
66 changes: 39 additions & 27 deletions sh/deploy_new_settler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ safe_address="$(get_config governance.deploymentSafe)"
declare -r safe_address

. "$project_root"/sh/common_safe.sh

declare signer
IFS='' read -p 'What address will you submit with?: ' -e -r signer
declare -r signer

. "$project_root"/sh/common_wallet_type.sh
. "$project_root"/sh/common_deploy_settler.sh

declare deploy_calldata
Expand All @@ -136,39 +142,45 @@ declare signing_hash
signing_hash="$(eip712_hash "$deploy_calldata" 1)"
declare -r signing_hash

declare signatures
signatures="$(curl --fail -s "$(get_config safe.apiUrl)"'/v1/multisig-transactions/'"$signing_hash"'/confirmations/?executed=false' -X GET)"
declare -r signatures
declare safe_url
safe_url="$(get_config safe.apiUrl)"
declare -r safe_url

if (( $(jq -Mr .count <<<"$signatures") != 1 )) ; then
echo 'Bad number of signatures' >&2
exit 1
fi
declare -a signatures=()
if [[ $safe_url = 'NOT SUPPORTED' ]] ; then
set +f
for confirmation in "$project_root"/settler_confirmation_"$chain_display_name"_"$(git rev-parse --short HEAD)"_*.txt ; do
signatures+=("$(<"$confirmation")")
done
set -f

declare other_signer
other_signer="$(jq -Mr '.results[0].owner' <<<"$signatures")"
declare -r other_signer
declare other_signature
other_signature="$(jq -Mr '.results[0].signature' <<<"$signatures")"
declare -r other_signature
if (( ${#signatures[@]} != 2 )) ; then
echo 'Bad number of signatures' >&2
exit 1
fi
else
declare signatures_json
signatures_json="$(curl --fail -s "$safe_url"'/v1/multisig-transactions/'"$signing_hash"'/confirmations/?executed=false' -X GET)"
declare -r signatures_json

declare signer_lower
signer_lower="$(tr '[:upper:]' '[:lower:]' <<<"$signer")"
declare -r signer_lower
declare other_signer_lower
other_signer_lower="$(tr '[:upper:]' '[:lower:]' <<<"$other_signer")"
declare -r other_signer_lower
if (( $(jq -Mr .count <<<"$signatures_json") != 2 )) ; then
echo 'Bad number of signatures' >&2
exit 1
fi

declare signature
signature="$(cast concat-hex "$(cast to-uint256 "$signer")" "$(cast hash-zero)" 0x01)"
declare -r signature
if [ "$(jq -Mr '.results[1].owner' <<<"$signatures_json" | tr '[:lower:]' '[:upper:]')" \< "$(jq -Mr '.results[0].owner' <<<"$signatures_json" | tr '[:lower:]' '[:upper:]')" ] ; then
signatures+=( "$(jq -Mr '.results[1].signature' <<<"$signatures_json")" )
signatures+=( "$(jq -Mr '.results[0].signature' <<<"$signatures_json")" )
else
signatures+=( "$(jq -Mr '.results[0].signature' <<<"$signatures_json")" )
signatures+=( "$(jq -Mr '.results[1].signature' <<<"$signatures_json")" )
fi
fi
declare -r -a signatures

declare packed_signatures
if [ "$other_signer_lower" \< "$signer_lower" ] ; then
packed_signatures="$(cast concat-hex "$other_signature" "$signature")"
else
packed_signatures="$(cast concat-hex "$signature" "$other_signature")"
fi
packed_signatures="$(cast concat-hex "${signatures[@]}")"
declare -r packed_signatures

# set minimum gas price to (mostly for Arbitrum and BNB)
declare -i min_gas_price
Expand Down
4 changes: 3 additions & 1 deletion sh/upgrade_deployer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ if [[ ${1:-unset} = 'deploy' ]] ; then
echo '' >&2

declare -a gas_price_args
if (( chainid != 56 )) ; then
if (( chainid != 56 )) && (( chainid != 534352 )) ; then
gas_price_args=(
--gas-price $gas_price --priority-gas-price $gas_price
)
Expand All @@ -208,6 +208,8 @@ if [[ ${1:-unset} = 'confirm' ]] ; then
declare -r safe_address

. "$project_root"/sh/common_safe.sh
. "$project_root"/sh/common_safe_owner.sh
. "$project_root"/sh/common_wallet_type.sh

if [[ ${deployed_address-unset} = 'unset' ]] ; then
declare deployed_address
Expand Down
Loading

0 comments on commit ecd28b3

Please sign in to comment.