Skip to content

Commit

Permalink
Tweak message gas requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkaplan13 committed Feb 13, 2024
1 parent 18bb595 commit 69974b4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion contracts/src/SimpleBettingGame.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ contract SimpleBettingGame is VRFConsumerBaseV2, ReentrancyGuard {
IVRFProxy internal immutable _vrfCoordinator;
uint64 public immutable vrfSubscriptionID;
bytes32 public immutable vrfKeyHash;
uint32 public constant VRF_CALLBACK_GAS_LIMIT = 100_000;
uint32 public constant VRF_CALLBACK_GAS_LIMIT = 200_000;
uint32 public constant MAX_VALUE = 100;

/**
Expand Down
6 changes: 3 additions & 3 deletions contracts/src/VRFProvider.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ contract VRFProvider is VRFConsumerBaseV2, TeleporterOwnerUpgradeable, Reentranc
* @dev Gas limits for receiving random words from the Chainlink VRF coordinator, and sending
* them in a Teleporter message to the partner Teleporter VRF coordinator contract.
*/
uint32 public constant TELEPORTER_CALLBACK_GAS_LIMIT_BASE = 100_000;
uint32 public constant TELEPORTER_CALLBACK_GAS_LIMIT_PER_WORD = 1_000;
uint32 public constant TELEPORTER_RECEIVE_MESSAGE_GAS_OVERHEAD = 20_000;
uint32 public constant TELEPORTER_CALLBACK_GAS_LIMIT_BASE = 300_000;
uint32 public constant TELEPORTER_CALLBACK_GAS_LIMIT_PER_WORD = 5_000;
uint32 public constant TELEPORTER_RECEIVE_MESSAGE_GAS_OVERHEAD = 300_000;

/**
* @dev Emitted when a message is received from the partner VRFProxy requesting random values.
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/VRFProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ contract VRFProxy is IVRFProxy, ReentrancyGuard, TeleporterOwnerUpgradeable {
* @dev The estimated amount of gas used by the VRFProvider on the partner chain to request random values from the
* Chainlink VRF coordinator. This is the required gas limit for the Teleporter message sent to request the values.
*/
uint256 public constant VRF_REQUEST_REQUIRED_GAS = 100_000;
uint256 public constant VRF_REQUEST_REQUIRED_GAS = 500_000;

/**
* @dev The blockchain ID of the partner blockchain where the VRFProvider contract is deployed.
Expand Down
20 changes: 16 additions & 4 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,31 @@ vrf_proxy_address=$(parseComputedContractAddress "$computed_proxy_contract_addre

# Deploy the VRFProvider contract to the C-chain.
cd $REPO_BASE_PATH/contracts
echo "Deploying VRFProvider to C-chain..."
forge create --private-key $user_private_key \
src/VRFProvider.sol:VRFProvider \
--constructor-args $c_chain_teleporter_registry_address $c_chain_vrf_coordinator_address $subnet_blockchain_id $vrf_proxy_address \
--rpc-url $c_chain_url
--rpc-url $c_chain_url > /dev/null
echo "Deployed VRFProvider to C-chain."

# Deploy the VRFProxy contract to the Subnet.
echo "Deploying VRFProxy to Subnet..."
forge create --private-key $user_private_key \
src/VRFProxy.sol:VRFProxy \
--constructor-args $subnet_teleporter_registry_address $c_chain_blockchain_id $vrf_provider_address \
--rpc-url $subnet_url
--rpc-url $subnet_url > /dev/null
echo "Deployed VRFProxy to Subnet."

# Deploy the SimpleBettingGame on the Subnet.
forge create --private-key $user_private_key \
echo "Deploying SimpleBettingGame to Subnet..."
simple_betting_game_deploy_result=$(forge create --private-key $user_private_key \
src/SimpleBettingGame.sol:SimpleBettingGame \
--constructor-args $vrf_proxy_address $c_chain_vrf_subscription_id $c_chain_vrf_key_hash \
--rpc-url $subnet_url
--rpc-url $subnet_url)
simple_betting_game_address=$(parseContractAddress "$simple_betting_game_deploy_result")
echo "Deployed SimpleBettingGame to Subnet."

echo "Finished deploying contracts."
echo "C-chain VRFProvider: $vrf_provider_address"
echo "Subnet VRFProxy: $vrf_proxy_address"
echo "Subnet SimpleBettingGame: $simple_betting_game_address"

0 comments on commit 69974b4

Please sign in to comment.