Skip to content

Commit

Permalink
Change transfer verifier testing to use anvil's account[13] instead o…
Browse files Browse the repository at this point in the history
…f account[1]
  • Loading branch information
johnsaigle committed Jan 21, 2025
1 parent 6f35275 commit 53b9b75
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 21 deletions.
5 changes: 4 additions & 1 deletion devnet/eth-devnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,16 @@ spec:
containers:
- name: anvil
image: eth-node
# This command generates additional accounts compared to the default of 10. The purpose is to use dedicated
# accounts for different aspects of the test suite. When adding new integration tests, consider increasing
# the number of accounts below and using a fresh key for the new tests.
command:
- anvil
- --silent
- --mnemonic=myth like bonus scare over problem client lizard pioneer submit female collect
- --block-time=1
- --host=0.0.0.0
- --accounts=13
- --accounts=14
- --chain-id=1337
ports:
- containerPort: 8545
Expand Down
5 changes: 4 additions & 1 deletion devnet/eth-devnet2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@ spec:
containers:
- name: anvil
image: eth-node
# This command generates additional accounts compared to the default of 10. The purpose is to use dedicated
# accounts for different aspects of the test suite. When adding new integration tests, consider increasing
# the number of accounts below and using a fresh key for the new tests.
command:
- anvil
- --silent
- --mnemonic=myth like bonus scare over problem client lizard pioneer submit female collect
- --block-time=1
- --host=0.0.0.0
- --accounts=13
- --accounts=14
- --chain-id=1397
ports:
- containerPort: 8545
Expand Down
16 changes: 8 additions & 8 deletions devnet/tx-verifier-monitor/transfer-verifier-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ ERC20_ADDR="0x47bdB2D7d6528C760b6f228b3B8F9F650169a10f" # Test token A
VALUE="1000" # Wei value sent as msg.value
TRANSFER_AMOUNT="10"

# Account reported by anvil when run using $MNEMONIC.
# The account at index 0 is used by other tests in the test suite, so
# account[1] is used here to help encapsulate the tests
ANVIL_USER="0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0"
# This account is generated by anvil and can be confirmed by running `anvil --accounts=13`.
# The accounts at other indices are used by other tests in the test suite, so
# account[13] is used here to help encapsulate the tests.
ANVIL_USER="0x64E078A8Aa15A41B85890265648e965De686bAE6"
ETH_WHALE="${ANVIL_USER}"
FROM="${ETH_WHALE}"
# Anvil user1 normalized to Wormhole size. (The value itself it unchecked but must have this format.)
RECIPIENT="0x000000000000000000000000FFcf8FDEE72ac11b5c542428B35EEF5769C409f0"
RECIPIENT="0x00000000000000000000000064E078A8Aa15A41B85890265648e965De686bAE6"
NONCE="234" # arbitrary

# Build the payload for token transfers. Declared on multiple lines to
Expand Down Expand Up @@ -60,12 +60,12 @@ echo "- VALUE=${VALUE}"
echo "- RECIPIENT=${RECIPIENT}"
echo

# Fund the token bridge from User0
echo "Start impersonating User0"
# Fund the token bridge from the user
echo "Start impersonating Anvil key: ${ANVIL_USER}"
cast rpc \
anvil_impersonateAccount "${ANVIL_USER}" \
--rpc-url "${RPC}"
echo "Funding token bridge using user0's balance"
echo "Funding token bridge using the user's balance"
cast send --unlocked \
--rpc-url "${RPC}" \
--from $ANVIL_USER \
Expand Down
26 changes: 15 additions & 11 deletions ethereum/forge-scripts/DeployTestToken.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ contract DeployTestToken is Script {
address transferVerificationTokenA
)
{
address[] memory accounts = new address[](13);
address[] memory accounts = new address[](14);
accounts[0] = 0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1;
accounts[1] = 0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0;
accounts[2] = 0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b;
Expand All @@ -56,6 +56,8 @@ contract DeployTestToken is Script {
accounts[10] = 0x610Bb1573d1046FCb8A70Bbbd395754cD57C2b60;
accounts[11] = 0x855FA758c77D68a04990E992aA4dcdeF899F654A;
accounts[12] = 0xfA2435Eacf10Ca62ae6787ba2fB044f8733Ee843;
accounts[13] = 0x64E078A8Aa15A41B85890265648e965De686bAE6;


ERC20PresetMinterPauser token = new ERC20PresetMinterPauser(
"Ethereum Test Token",
Expand Down Expand Up @@ -98,24 +100,26 @@ contract DeployTestToken is Script {
// mint 1000 units
accountantToken.mint(accounts[9], 1_000_000_000_000_000_000_000);

for(uint16 i=0; i<11; i++) {
// Give the accounts enough eth to send transactions
vm.deal(accounts[i], 1e18);
}

// Deploy a test token for Transfer Verification
ERC20PresetMinterPauser deployedA = new ERC20PresetMinterPauser(
"TransferVerifier Test Token A",
"TVA"
);

console.log("Test token A deployed at: ", address(deployedA));

// Mint test tokens to Anvil's default account at index 1.
// The account at index 0 is used for other tests in the devnet, so
// using account 1 to send transfers will hopefully cause things to be
// Mint Eth and test tokens to Anvil's default account at index 13.
// This will be used for Transfer Verification integration tests.
// The other accounts created by Anvil are used for other tests in the devnet, so
// using account 14 to send transfers will hopefully cause things to be
// better encapsulated.
deployedA.mint(accounts[1], 1_000_000_000_000_000_000_000);

for(uint16 i=0; i<11; i++) {
// Give the accounts enough eth to send transactions
vm.deal(accounts[i], 1e18);
}
deployedA.mint(accounts[13], 1_000_000_000_000_000_000_000);
token.mint(accounts[13], 1_000_000_000_000_000_000_000);
vm.deal(accounts[13], 1e18);

return (
address(token),
Expand Down

0 comments on commit 53b9b75

Please sign in to comment.