Upgrade gnosis safe libraries (#1443)

pull/1489/head show
Asa Oines 2 years ago committed by GitHub
parent 0ab04dc677
commit e97cac2325
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .gitmodules
  2. 8
      solidity/package.json
  3. 2
      typescript/helloworld
  4. 17
      typescript/infra/package.json
  5. 3
      typescript/infra/scripts/safe-delegate.ts
  6. 4
      typescript/infra/src/agents/aws/key.ts
  7. 2
      typescript/infra/src/config/chain.ts
  8. 21
      typescript/infra/src/core/govern.ts
  9. 6
      typescript/infra/src/core/multisend.ts
  10. 10
      typescript/infra/src/utils/safe.ts
  11. 6
      typescript/sdk/package.json
  12. 2
      typescript/sdk/src/consts/chainMetadata.ts
  13. 2
      typescript/token
  14. 2
      typescript/utils/package.json
  15. 619
      yarn.lock

4
.gitmodules vendored

@ -1,8 +1,8 @@
[submodule "typescript/token"]
path = typescript/token
url = git@github.com:hyperlane-xyz/hyperlane-token.git
branch = main
branch = asaj/update-deps
[submodule "typescript/helloworld"]
path = typescript/helloworld
url = git@github.com:hyperlane-xyz/hyperlane-app-template.git
branch = main
branch = asaj/upgrade-deps

@ -8,13 +8,13 @@
"@openzeppelin/contracts-upgradeable": "^4.8.0"
},
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.5",
"@nomiclabs/hardhat-waffle": "^2.0.2",
"@nomiclabs/hardhat-ethers": "^2.2.1",
"@nomiclabs/hardhat-waffle": "^2.0.3",
"@typechain/ethers-v5": "10.0.0",
"@typechain/hardhat": "^6.0.0",
"chai": "^4.3.0",
"ethereum-waffle": "^3.4.4",
"ethers": "^5.6.8",
"ethers": "^5.7.2",
"hardhat": "^2.8.4",
"hardhat-gas-reporter": "^1.0.7",
"prettier": "^2.4.1",
@ -23,7 +23,7 @@
"solhint-plugin-prettier": "^0.0.5",
"solidity-coverage": "^0.7.14",
"ts-generator": "^0.1.1",
"typechain": "8.0.0",
"typechain": "^8.1.1",
"typescript": "^4.7.2"
},
"directories": {

@ -1 +1 @@
Subproject commit 646f1e7beb18a77e5ca2535dba130f75793aea0f
Subproject commit be1860eb08346bcb6a9b10943b06ad17c5d87135

@ -6,16 +6,17 @@
"@aws-sdk/client-iam": "^3.74.0",
"@aws-sdk/client-kms": "3.48.0",
"@aws-sdk/client-s3": "^3.74.0",
"@ethersproject/experimental": "^5.6.2",
"@ethersproject/hardware-wallets": "~5.6",
"@gnosis.pm/safe-core-sdk": "^2.3.2",
"@gnosis.pm/safe-ethers-lib": "^1.4.0",
"@gnosis.pm/safe-service-client": "^1.2.0",
"@ethersproject/experimental": "^5.7.0",
"@ethersproject/hardware-wallets": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"@hyperlane-xyz/celo-ethers-provider": "^0.1.1",
"@hyperlane-xyz/helloworld": "1.0.0-beta3",
"@hyperlane-xyz/sdk": "1.0.0-beta3",
"@hyperlane-xyz/utils": "1.0.0-beta3",
"@nomiclabs/hardhat-etherscan": "^3.0.3",
"@safe-global/safe-core-sdk": "3.2.0",
"@safe-global/safe-ethers-lib": "^1.7.0",
"@safe-global/safe-service-client": "^1.4.0",
"asn1.js": "5.4.1",
"aws-kms-ethers-signer": "^0.1.3",
"dotenv": "^10.0.0",
@ -24,8 +25,8 @@
"yargs": "^17.4.1"
},
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.5",
"@nomiclabs/hardhat-waffle": "^2.0.2",
"@nomiclabs/hardhat-ethers": "^2.2.1",
"@nomiclabs/hardhat-waffle": "^2.0.3",
"@types/chai": "^4.2.21",
"@types/mocha": "^9.1.0",
"@types/node": "^16.9.1",
@ -33,7 +34,7 @@
"@types/yargs": "^17.0.10",
"chai": "^4.3.4",
"ethereum-waffle": "^3.4.4",
"ethers": "^5.6.8",
"ethers": "^5.7.2",
"hardhat": "^2.8.4",
"prettier": "^2.4.1",
"ts-node": "^10.8.0",

@ -2,7 +2,7 @@ import { LedgerSigner } from '@ethersproject/hardware-wallets';
// Due to TS funkiness, the following needs to be imported in order for this
// code to build, but needs to be removed in order for the code to run.
import '@ethersproject/hardware-wallets/thirdparty';
import { SafeDelegateConfig } from '@gnosis.pm/safe-service-client';
import { SafeDelegateConfig } from '@safe-global/safe-service-client';
import yargs from 'yargs';
import { AllChains } from '@hyperlane-xyz/sdk';
@ -38,6 +38,7 @@ async function delegate() {
const safeService = getSafeService(chain, connection);
const delegates = await getSafeDelegates(safeService, safe);
console.log('Connecting to ledger, ensure plugged in and unlocked...');
// Ledger Live derivation path, vary by changing the index i.e.
// "m/44'/60'/{CHANGE_ME}'/0/0";
const path = "m/44'/60'/0'/0/0";

@ -231,6 +231,10 @@ export class AgentAwsKey extends CloudAgentKey {
if (!keyId) {
throw Error('Key ID not defined');
}
// @ts-ignore We're using a newer version of Provider than
// KmsEthersSigner. The return type for getFeeData for this newer
// type is a superset of the return type for getFeeData for the older type,
// which should be fine.
return new KmsEthersSigner(
{
keyId,

@ -30,7 +30,7 @@ export async function fetchProvider(
environment: DeployEnvironment,
chainName: ChainName,
connectionType: ConnectionType = ConnectionType.Http,
) {
): Promise<ethers.providers.Provider> {
if (
connectionType !== ConnectionType.Http &&
connectionType !== ConnectionType.HttpQuorum

@ -38,10 +38,12 @@ type AnnotatedCallData = types.CallData & {
export class HyperlaneCoreGovernor<Chain extends ChainName> {
readonly checker: HyperlaneCoreChecker<Chain>;
private calls: ChainMap<Chain, AnnotatedCallData[]>;
private canPropose: ChainMap<Chain, Map<string, boolean>>;
constructor(checker: HyperlaneCoreChecker<Chain>) {
this.checker = checker;
this.calls = objMap(this.checker.app.contractsMap, () => []);
this.canPropose = objMap(this.checker.app.contractsMap, () => new Map());
}
async govern() {
@ -167,15 +169,20 @@ export class HyperlaneCoreGovernor<Chain extends ChainName> {
const signer = connection.signer;
if (!signer) throw new Error(`no signer found`);
const signerAddress = await signer.getAddress();
const proposer = await canProposeSafeTransactions(
signerAddress,
chain,
connection,
safeAddress,
);
if (!this.canPropose[chain].has(safeAddress)) {
this.canPropose[chain].set(
safeAddress,
await canProposeSafeTransactions(
signerAddress,
chain,
connection,
safeAddress,
),
);
}
// 2b. Check if calling from the owner will succeed.
if (proposer) {
if (this.canPropose[chain].get(safeAddress)) {
try {
await connection.provider.estimateGas({
...call,

@ -55,10 +55,12 @@ export class SafeMultiSend extends MultiSend {
async sendTransactions(calls: types.CallData[]) {
const safeSdk = await getSafe(this.connection, this.safeAddress);
const transactions = calls.map((call) => {
const safeTransactionData = calls.map((call) => {
return { to: call.to, data: call.data.toString(), value: '0' };
});
const safeTransaction = await safeSdk.createTransaction(transactions);
const safeTransaction = await safeSdk.createTransaction({
safeTransactionData,
});
const safeTxHash = await safeSdk.getTransactionHash(safeTransaction);
const senderSignature = await safeSdk.signTransactionHash(safeTxHash);

@ -1,6 +1,6 @@
import Safe from '@gnosis.pm/safe-core-sdk';
import EthersAdapter from '@gnosis.pm/safe-ethers-lib';
import SafeServiceClient from '@gnosis.pm/safe-service-client';
import Safe from '@safe-global/safe-core-sdk';
import EthersAdapter from '@safe-global/safe-ethers-lib';
import SafeServiceClient from '@safe-global/safe-service-client';
import { ethers } from 'ethers';
import { ChainConnection, ChainName, chainMetadata } from '@hyperlane-xyz/sdk';
@ -11,7 +11,7 @@ export function getSafeService(
): SafeServiceClient {
const signer = connection.signer;
if (!signer) throw new Error(`no signer found for ${chain}`);
const ethAdapter = new EthersAdapter({ ethers, signer });
const ethAdapter = new EthersAdapter({ ethers, signerOrProvider: signer });
const txServiceUrl = chainMetadata[chain].gnosisSafeTransactionServiceUrl;
if (!txServiceUrl)
throw new Error(`must provide tx service url for ${chain}`);
@ -24,7 +24,7 @@ export function getSafe(
): Promise<Safe> {
const signer = connection.signer;
if (!signer) throw new Error(`no signer found`);
const ethAdapter = new EthersAdapter({ ethers, signer });
const ethAdapter = new EthersAdapter({ ethers, signerOrProvider: signer });
return Safe.create({
ethAdapter,
safeAddress: safeAddress,

@ -10,11 +10,11 @@
"coingecko-api": "^1.0.10",
"cross-fetch": "^3.1.5",
"debug": "^4.3.4",
"ethers": "^5.6.8"
"ethers": "^5.7.2"
},
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.5",
"@nomiclabs/hardhat-waffle": "^2.0.2",
"@nomiclabs/hardhat-ethers": "^2.2.1",
"@nomiclabs/hardhat-waffle": "^2.0.3",
"@types/coingecko-api": "^1.0.10",
"@types/debug": "^4.1.7",
"@types/node": "^16.9.1",

@ -382,6 +382,8 @@ export const moonbeam: ChainMetadata = {
reorgPeriod: 1,
estimateBlockTime: 12,
},
gnosisSafeTransactionServiceUrl:
'https://transaction.multisig.moonbeam.network',
};
export const mumbai: ChainMetadata = {

@ -1 +1 @@
Subproject commit ca7bb745a6fb9f21ec727a1a41a55c800d2f453a
Subproject commit a63436e4ebb222ed7c4c4c2ea18a54065775dbd1

@ -3,7 +3,7 @@
"description": "General utilities for the Hyperlane network",
"version": "1.0.0-beta3",
"dependencies": {
"ethers": "^5.6.8"
"ethers": "^5.7.2"
},
"devDependencies": {
"chai": "^4.3.0",

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save