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

Transactions dropped from mempool with USDC deploy scripts #273

Closed
nvdtf opened this issue May 29, 2024 · 2 comments
Closed

Transactions dropped from mempool with USDC deploy scripts #273

nvdtf opened this issue May 29, 2024 · 2 comments
Assignees
Labels

Comments

@nvdtf
Copy link
Member

nvdtf commented May 29, 2024

Problem

Deploying USDC contracts fail due to an error in transaction submission with Foundry:

Transaction dropped from the mempool

Steps to Reproduce

Following the official deployment guide: https://github.com/circlefin/stablecoin-evm/?tab=readme-ov-file#deployment

  1. Clone https://github.com/circlefin/stablecoin-evm/
  2. yarn install
  3. Verify yarn compile succeeds.
  4. Verify yarn test succeeds.
  5. My env config:
export GAS_MULTIPLIER=1
export TOKEN_NAME="USDC TEST"
export TOKEN_SYMBOL="USDC"
export TOKEN_CURRENCY="USD"
export TOKEN_DECIMALS=6
export PROXY_ADMIN_ADDRESS=0x9a537FAeAd5809d0f8c0D1b365E363FB46005bF3
export MASTER_MINTER_OWNER_ADDRESS=0x0514250500425DdE3bb35D49cC75F5ea861BCbFc
export OWNER_ADDRESS=0x0514250500425DdE3bb35D49cC75F5ea861BCbFc
export DEPLOYER_PRIVATE_KEY=0xd9ae6467cabb04657fc1b69d61d44876041292c0fddad1e34bf731bd10826ec6
  1. Run deploy script and fail:
yarn forge:broadcast scripts/deploy/deploy-fiat-token.s.sol --rpc-url https://previewnet.evm.nodes.onflow.org --legacy --slow

Result:

yarn run v1.22.19
$ yarn forge:simulate --broadcast scripts/deploy/deploy-fiat-token.s.sol --rpc-url https://previewnet.evm.nodes.onflow.org --legacy --slow
$ forge script -vv --gas-estimate-multiplier $(dotenv -p GAS_MULTIPLIER) --broadcast scripts/deploy/deploy-fiat-token.s.sol --rpc-url https://previewnet.evm.nodes.onflow.org --legacy --slow
[⠒] Compiling...
No files changed, compilation skipped
Script ran successfully.

== Return ==
0: contract FiatTokenV2_2 0x1FA6Ce3Cd18b07D64C63a6320a2C6C10E47e9A71
1: contract MasterMinter 0x3f66B8C0a99b80F68bc15A7608D4e5c60e5b3128
2: contract FiatTokenProxy 0x7dFcC6f93f3FBa7Cb67a916B7DD3518c1EA7d040

== Logs ==
  TOKEN_NAME: 'USDC TEST'
  TOKEN_SYMBOL: 'USDC'
  TOKEN_CURRENCY: 'USD'
  TOKEN_DECIMALS: '6'
  FIAT_TOKEN_IMPLEMENTATION_ADDRESS: '0x0000000000000000000000000000000000000000'
  PROXY_ADMIN_ADDRESS: '0x9a537FAeAd5809d0f8c0D1b365E363FB46005bF3'
  MASTER_MINTER_OWNER_ADDRESS: '0x0514250500425DdE3bb35D49cC75F5ea861BCbFc'
  OWNER_ADDRESS: '0x0514250500425DdE3bb35D49cC75F5ea861BCbFc'
  PAUSER_ADDRESS: '0x0514250500425DdE3bb35D49cC75F5ea861BCbFc'
  BLACKLISTER_ADDRESS: '0x0514250500425DdE3bb35D49cC75F5ea861BCbFc'

## Setting up 1 EVM.

==========================

Chain 646

Estimated gas price: 0 gwei

Estimated total gas used for script: 80573

Estimated amount required: 0. ETH

==========================
##
Sending transactions [0 - 0].
⠁ [00:00:00] [########>-------------------------------------------------------------------------------------------------------------------] 1/14 txes (3.1s)##
Waiting for receipts.

Transactions saved to: /Users/navidtehranifar/go/src/github.com/circlefin/stablecoin-evm/broadcast/deploy-fiat-token.s.sol/646/run-latest.json

Sensitive values saved to: /Users/navidtehranifar/go/src/github.com/circlefin/stablecoin-evm/cache/foundry/deploy-fiat-token.s.sol/646/run-latest.json

Error:
Transaction dropped from the mempool: 0x8aa7f066e9050467f9e4257f2d0992681dd4e41148efbb2903c2306ae5a08c6e
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

The above script will try to run 14 transactions (one by one since we used --slow). I'm not sure how to debug as the transaction hash cannot be fetched:

cast tx 0x8aa7f066e9050467f9e4257f2d0992681dd4e41148efbb2903c2306ae5a08c6e --rpc-url https://previewnet.evm.nodes.onflow.org
Error:
tx not found: 0x8aa7f066e9050467f9e4257f2d0992681dd4e41148efbb2903c2306ae5a08c6e

Acceptance Criteria

The deployment script in the above repo should succeed on PreviewNet.

Context

Onboarding USDC on Flow EVM

@franklywatson
Copy link
Contributor

Thanks for reporting. This is probably related to the API method which these tools are using txpool_context which shares information about transactions in mempool; except there is no mempool in Flow EVM. I think that @sideninja and @ramtinms might be taking a look at this next week, not sure how straightforward the fix is

@m-Peter
Copy link
Collaborator

m-Peter commented May 30, 2024

@franklywatson @nvdtf I had a look at this, and I was able to successfully run the USDC deploy scripts.
The problem was in the following env variable:

export GAS_MULTIPLIER=1

which would incorrectly scale down the estimated gas, causing the contract deployments to fail. The documentation for this flag mentions:

-g, --gas-estimate-multiplier <GAS_ESTIMATE_MULTIPLIER>
          Relative percentage to multiply gas estimates by
          
          [default: 130]

so by changing the above env variable to its default value:

export GAS_MULTIPLIER=130

the deployment works as expected.

➜  stablecoin-evm git:(master) yarn forge:broadcast scripts/deploy/deploy-fiat-token.s.sol --rpc-url http://localhost:8545 --legacy --slow
yarn run v1.22.19
$ yarn forge:simulate --broadcast scripts/deploy/deploy-fiat-token.s.sol --rpc-url http://localhost:8545 --legacy --slow
$ forge script -vv --gas-estimate-multiplier $(dotenv -p GAS_MULTIPLIER) --broadcast scripts/deploy/deploy-fiat-token.s.sol --rpc-url http://localhost:8545 --legacy --slow
[⠒] Compiling...
No files changed, compilation skipped
Script ran successfully.

== Return ==
0: contract FiatTokenV2_2 0xA973D931a31E2a5FE5B2D5895210f273aea320E2
1: contract MasterMinter 0x807Aeda4b612a2ceE5a09fcC0006e70D71D6c5Ea
2: contract FiatTokenProxy 0x5EB76EecF2591A70e397855888Bab0170F0A5aF8

== Logs ==
  TOKEN_NAME: 'USDC TEST'
  TOKEN_SYMBOL: 'USDC'
  TOKEN_CURRENCY: 'USD'
  TOKEN_DECIMALS: '6'
  FIAT_TOKEN_IMPLEMENTATION_ADDRESS: '0x0000000000000000000000000000000000000000'
  PROXY_ADMIN_ADDRESS: '0x9a537FAeAd5809d0f8c0D1b365E363FB46005bF3'
  MASTER_MINTER_OWNER_ADDRESS: '0x0514250500425DdE3bb35D49cC75F5ea861BCbFc'
  OWNER_ADDRESS: '0x0514250500425DdE3bb35D49cC75F5ea861BCbFc'
  PAUSER_ADDRESS: '0x0514250500425DdE3bb35D49cC75F5ea861BCbFc'
  BLACKLISTER_ADDRESS: '0x0514250500425DdE3bb35D49cC75F5ea861BCbFc'

## Setting up 1 EVM.

==========================

Chain 646

Estimated gas price: 0 gwei

Estimated total gas used for script: 10492605

Estimated amount required: 0. ETH

==========================
##
Sending transactions [0 - 0].
⠁ [00:00:00] [######>-----------------------------------------------------------------------------------] 1/14 txes (2.0s)##
Waiting for receipts.
⠉ [00:00:00] [#######################################################################################] 1/1 receipts (0.0s)
##### 646
✅  [Success]Hash: 0x20d3638f420a44b404ef9a1e60702d421eaee2a0c40b3009f1b4af5bf6eef3f0
Contract Address: 0xbB8F9eA11F1ADB9A13f3d0659999DdB3D3B5e779
Block: 3
Gas Used: 427367

##
Sending transactions [1 - 1].
⠉ [00:00:00] [############>-----------------------------------------------------------------------------] 2/14 txes (2.3s)##
Waiting for receipts.
⠉ [00:00:00] [#######################################################################################] 1/1 receipts (0.0s)
##### 646
✅  [Success]Hash: 0x9d6f09d88410af32fcf3b5ce748858ea7a8dd80100db47f11e85e9d0fc890343
Contract Address: 0xA973D931a31E2a5FE5B2D5895210f273aea320E2
Block: 4
Gas Used: 5112798

##
Sending transactions [2 - 2].
⠙ [00:00:00] [###################>----------------------------------------------------------------------] 3/14 txes (2.2s)##
Waiting for receipts.
⠉ [00:00:00] [#######################################################################################] 1/1 receipts (0.0s)
##### 646
✅  [Success]Hash: 0x9d5fb009717efdb025cda4f3406fee7ca91ae3e5951bac0b66e8ea3e7dce91ed
Block: 5
Gas Used: 107135

##
Sending transactions [3 - 3].
⠚ [00:00:00] [#########################>----------------------------------------------------------------] 4/14 txes (2.1s)##
Waiting for receipts.
⠉ [00:00:00] [#######################################################################################] 1/1 receipts (0.0s)
##### 646
✅  [Success]Hash: 0x015c88b240bf504751853145654dd47b6cb9fa6f35ad8d8606aadea3fe04e843
Block: 6
Gas Used: 91464

##
Sending transactions [4 - 4].
⠒ [00:00:01] [################################>---------------------------------------------------------] 5/14 txes (1.9s)##
Waiting for receipts.
⠉ [00:00:00] [#######################################################################################] 1/1 receipts (0.0s)
##### 646
✅  [Success]Hash: 0x28cb0eea1f895aad2ded4cf34928b26a5dd2238a74509a9cd2696f97efa5da39
Block: 7
Gas Used: 49209

##
Sending transactions [5 - 5].
⠂ [00:00:01] [######################################>---------------------------------------------------] 6/14 txes (1.7s)##
Waiting for receipts.
⠉ [00:00:00] [#######################################################################################] 1/1 receipts (0.0s)
##### 646
✅  [Success]Hash: 0x17c1ed070514b2186b91a3f67f3c89c03e0ede110c4ad5c248492cdb86466191
Block: 8
Gas Used: 34815

##
Sending transactions [6 - 6].
⠂ [00:00:01] [#############################################>--------------------------------------------] 7/14 txes (1.5s)##
Waiting for receipts.
⠉ [00:00:00] [#######################################################################################] 1/1 receipts (0.0s)
##### 646
✅  [Success]Hash: 0x808556027a7fb004ec298dc9153992925bea2049d78ee7ca156ddeda852916c6
Contract Address: 0x5EB76EecF2591A70e397855888Bab0170F0A5aF8
Block: 9
Gas Used: 492495

##
Sending transactions [7 - 7].
⠒ [00:00:01] [###################################################>--------------------------------------] 8/14 txes (1.3s)##
Waiting for receipts.
⠉ [00:00:00] [#######################################################################################] 1/1 receipts (0.0s)
##### 646
✅  [Success]Hash: 0x2c7652c40bbe22f4e0e4a095b295c80ea86ed730299f01dab9cccf89dd02b695
Contract Address: 0x807Aeda4b612a2ceE5a09fcC0006e70D71D6c5Ea
Block: 10
Gas Used: 1245812

##
Sending transactions [8 - 8].
⠲ [00:00:02] [#########################################################>--------------------------------] 9/14 txes (1.1s)##
Waiting for receipts.
⠉ [00:00:00] [#######################################################################################] 1/1 receipts (0.0s)
##### 646
✅  [Success]Hash: 0x4487614620f5dd6362d04219b899b0d337067848e40d05c2d5191cedea5cfd71
Block: 11
Gas Used: 25533

##
Sending transactions [9 - 9].
⠴ [00:00:02] [###############################################################>-------------------------] 10/14 txes (0.9s)##
Waiting for receipts.
⠉ [00:00:00] [#######################################################################################] 1/1 receipts (0.0s)
##### 646
✅  [Success]Hash: 0x24304dda8e2e954d468d84e3002b9d66c05de5840691bf7af54ceaf5e01c85e9
Block: 12
Gas Used: 28240

##
Sending transactions [10 - 10].
⠤ [00:00:02] [#####################################################################>-------------------] 11/14 txes (0.7s)##
Waiting for receipts.
⠉ [00:00:00] [#######################################################################################] 1/1 receipts (0.0s)
##### 646
✅  [Success]Hash: 0x159b9033ac59916f992ff6f15aed962f3e8c3c82a7b756e8159ca77e36c6d31a
Block: 13
Gas Used: 211042

##
Sending transactions [11 - 11].
⠄ [00:00:02] [############################################################################>------------] 12/14 txes (0.4s)##
Waiting for receipts.
⠉ [00:00:00] [#######################################################################################] 1/1 receipts (0.0s)
##### 646
✅  [Success]Hash: 0x78b8d52490565b44c8443a2e03be106e0eeec453946bb12fc6231e92be95b77a
Block: 14
Gas Used: 81124

##
Sending transactions [12 - 12].
⠄ [00:00:02] [##################################################################################>------] 13/14 txes (0.2s)##
Waiting for receipts.
⠉ [00:00:00] [#######################################################################################] 1/1 receipts (0.0s)
##### 646
✅  [Success]Hash: 0xa423c74b6846c935779b088c49efd327af8ec4e347d635714a8465742ab743bb
Block: 15
Gas Used: 56587

##
Sending transactions [13 - 13].
⠤ [00:00:03] [#########################################################################################] 14/14 txes (0.0s)##
Waiting for receipts.
⠉ [00:00:00] [#######################################################################################] 1/1 receipts (0.0s)
##### 646
✅  [Success]Hash: 0xc071daa8f02b8ba0e933e713bf1e10a1905cdeeba9bd7cde282eb0cd528c84df
Block: 16
Gas Used: 44295



==========================

ONCHAIN EXECUTION COMPLETE & SUCCESSFUL.
Total Paid: 0. ETH (8007916 gas * avg 0 gwei)

Transactions saved to: /home/mpeter/Dev/stablecoin-evm/broadcast/deploy-fiat-token.s.sol/646/run-latest.json

Sensitive values saved to: /home/mpeter/Dev/stablecoin-evm/cache/foundry/deploy-fiat-token.s.sol/646/run-latest.json

Done in 4.81s.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

3 participants