Closed segonse closed 2 months ago
Hello @segonse, thanks for posting this. It seems that you are having a mismatch between the subscription ID you are generating and the one you have on Chainlink.
I would like to have more context here, are you using the same wallet address on both? can you share the entire code and script you are using the execute this?
In my impression, there might be a mismatch in the execution of both steps, making the process use two different IDs, but I'm not sure, so I would like you to share your code first.
cheers.
Hello @segonse, thanks for posting this. It seems that you are having a mismatch between the subscription ID you are generating and the one you have on Chainlink.
I would like to have more context here, are you using the same wallet address on both? can you share the entire code and script you are using the execute this?
In my impression, there might be a mismatch in the execution of both steps, making the process use two different IDs, but I'm not sure, so I would like you to share your code first.
cheers.
ok,this is my test code: https://github.com/segonse/smart-contract-lottery/tree/vrf-v2.5
executed command: forge script script/Interactions.s.sol:CreateSubscription ARGS="--network sepolia"
have you created the subscription ID with the same wallet that you are using for sending the transaction?
have you created the subscription ID with the same wallet that you are using for sending the transaction?
yes. And my subscription in chainlink created after the script was executed, should not be different account.
@segonse Good catch! I discovered the same thing. From my understanding, this is because forge
simulates the on-chain execution first (the first subscription ID). Then, it provides you another trace is from forge
giving you a "prediction" of how the actual on-chain execution of the script will go (the second subscription ID); along with estimated gas costs.
The actual execution of the transactions from our script will not have a trace in the output. You would need to check the transaction hash on the blockchain explorer of the network you ran the script on to check events etc. Also, "console" is a foundry thing, therefore, you won't be able to get that as output either. You would have to check the SubscriptionCreated
event on the explorer or the Chainlink UI to get the actual subscription ID.
The following is a response I got from ChatGPT when I was trying to figure this out:
Initial Traces (Simulation): The detailed traces you see during the execution of forge script are from Foundry's simulation environment. Simulated On-Chain Traces: These are a preview of what would happen on-chain, provided after the simulation but before actual on-chain execution. Actual On-Chain Logs: These are the real execution logs from the blockchain after the script is broadcasted and executed on the network.
Let me know if this helps!
@segonse Good catch! I discovered the same thing. From my understanding, this is because
forge
simulates the on-chain execution first (the first subscription ID). Then, it provides you another trace is fromforge
giving you a "prediction" of how the actual on-chain execution of the script will go (the second subscription ID); along with estimated gas costs.The actual execution of the transactions from our script will not have a trace in the output. You would need to check the transaction hash on the blockchain explorer of the network you ran the script on to check events etc. Also, "console" is a foundry thing, therefore, you won't be able to get that as output either. You would have to check the
SubscriptionCreated
event on the explorer or the Chainlink UI to get the actual subscription ID.The following is a response I got from ChatGPT when I was trying to figure this out:
Initial Traces (Simulation): The detailed traces you see during the execution of forge script are from Foundry's simulation environment. Simulated On-Chain Traces: These are a preview of what would happen on-chain, provided after the simulation but before actual on-chain execution. Actual On-Chain Logs: These are the real execution logs from the blockchain after the script is broadcasted and executed on the network.
Let me know if this helps!
thank you!Fortunately, I went to the chainlink web page and looked at my subscription id
this is my code
this is execute
make createSubscription ARGS="--network sepolia"
echothis is my chianlink create subscription, It is created by the command just executed, only the subid on chainlink can be properly funded